Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Patterned like in Derived Field

Status
Not open for further replies.

christimess

Programmer
May 26, 2004
33
US
I am trying to create a derived field that looks like this:
DECODE(SUBSTR("PS_EMPLOYMENT"."CUSTOM_AREA1",1,4),
LIKE '1%%%', 'FEDERAL',
LIKE '2%%%', 'STATE',
'UNKNOWN')
However, it does not like my statement. I know I can do it the long way:
DECODE(SUBSTR("PS_EMPLOYMENT"."CUSTOM_AREA1",1,4),
'1000', 'FEDERAL',
'1001', 'FEDERAL',
and so on, but the list would be very long and would take so long to do I though there has to be a better way, which is why I thought of using the LIKE statement.
Thanks for your help.
 
You can't use Like in a Derived Field. The reason it shows up in the Derived Field editor is beause the same editor is used for SQL Selection Critera and Like is valid there.

Try this:

DECODE(LEFT("PS_EMPLOYMENT"."CUSTOM_AREA1",1),
'1', 'FEDERAL',
'2', 'STATE',
'UNKNOWN')

Specializing in ReportSmith Training and Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top