Jenny Zhang wrote:
> I can not find in the SAPDB documentation any information about CASE
> statement. If SAPDB does not support CASE statement, is there any
> workaround if I want to do:
>
> select
> 100.00 * sum(case
> when p_type like 'PROMO%'
> then l_extendedprice * (1 - l_discount)
> else 0
> end) / sum(l_extendedprice * (1 - l_discount)) as
> promo_revenue
> from
> lineitem,
> part
> where
> l_partkey = p_partkey
> and l_shipdate >= '1997-02-01'
> and l_shipdate < '1997-03-01'
SAP DB does not support the CASE-function so far.
We are just implementing it for one of the next major releases (not 7.3.*).
A workaround is often possible with decode. decode is like a number
of equal-conditions and an else-part.
like 'xyz%' means starting with 'xyz' and anything else behind
--> change case (...) to
decode (substr(p_type, 1, 5),
'PROMO' , l_extendedprice * (1 - l_discount),
0)
that should work.
Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general