All Forums UDA
marcmc 112 posts Joined 12/05
26 Mar 2008
Case Statement Variable.

Can a variable be used inside a case statement like so:SELECT (CASE WHEN Year_id = :v_Year_id THEN 1 END)FROM ......

January 5 posts Joined 03/08
29 Mar 2008

You can use paramenter in macro,for example:create macro testm(iday char(10)) as(select case when date=:iday then 1 else 0 end;);usage:exec testm('2008-03-29');

psaini0 1 post Joined 07/11
30 Jul 2011

can variables be used with 'then' clause of case statement??

select case when year='2011' and mon='jan' then :dayid
else -100 end as day_id_key from ..............

You must sign in to leave a comment.