hi all,
how can i implement CASE Logic in datastage..
for ex: CASE when 'tan' then 'tango' when 'asc' then 'ascential'...like that
i hope it will wrks using 'if then else',but thinking to use CASE..
thanks in advance
CASE tatement
Moderators: chulett, rschirm, roy
CASE tatement
Thanx&Regards
scorpion
scorpion
The CASE statement is used in multi-line programs while the IF-THEN-ELSE can be done on a single line (i.e. in a stage variable or derivation).
The CASE in a BASIC program looks like
The CASE in a BASIC program looks like
Code: Select all
BEGIN CASE
CASE I=AmTired
Ans = 'Goto Sleep'
CASE Today='Tuesday'
Ans = 'Only 3 days left to the weekend'
CASE 1
Ans = 'This is the catchall'
END CASE
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Most databases allow CASE constructs in SELECT statements. You can put the entire construct in the Derivation field in the Columns grid (rather than use user-defined SQL).
Code: Select all
CASE WHEN PROD_CODE = 'tan' THEN 'tango' WHEN PROD_CODE = 'asc' THEN 'Ascential' ELSE 'unknown' END AS PRODUCT
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.