TABLE LAYOUT:
ID NOT NULL NUMBER (38)
LABEL NOT NULL NVARCHAR2 (60)
PARENTID NOT NULL NUMBER (38)
SELECT
*
FROM
(SELECT sYear, sMonth, SUM(DataLoad) AS DataLoad,
Entity, sAcct, sGovCode
FROM
(SELECT
EABB_FACT.YearID AS sYear,
EABB_PERIOD.Label AS sMonth,
EABB_FACT.dData AS DataLoad,
EABB_ENTITY.Label AS Entity,
(CASE
WHEN EABB_ACCOUNT.Label = '4210US'
AND SUBSTR (HAL_FACTS_II_APPROP_STATUS.STAT,1,1) = 'E'
THEN '4650' || SUBSTR (EABB_ACCOUNT.Label,5,2)
WHEN EABB_ACCOUNT.Label in ('4540US','4510US','4560US')
AND SUBSTR (HAL_FACTS_II_APPROP_STATUS.STAT,1,1) = 'E'
THEN '4650' || SUBSTR (EABB_ACCOUNT.Label,5,2)
Can someone tell me why I have to use the substr() function in order to select a part of a record(s) that has number and lettes i.e. 4650US and then us the concenation function to put the letters "US" back? Is there a simpler way to get this function to work the will also keep the attributes of the table?