Quantcast
Viewing all articles
Browse latest Browse all 974

Re: SAP HANA Query

Hello Ali,

 

you find the SQL documentation of SAP HANA here:

SAP HANA Platform (Core) – SAP Help Portal Page

 

If you look at the error HANA complains about the "if" because there is no real if-statemant outside of procedures in HANA. However, you can youse a "CASE" statement like this:

 

<simple_case_expression> ::=

  CASE <expression>

  WHEN <expression> THEN <expression>

  [{ WHEN <expression> THEN <expression>}…]

  [ ELSE <expression>]

  END

 

(from:  Expressions - SAP HANA SQL and System Views Reference - SAP Library )

 

so with some real content this could look like:

 

select
  item
, value, cost, margin, abc_cat,
 
casewhen   margin / value <(sum(value)over()- sum(cost)over())/ sum(value)over()   then'BELOW'
  
else'ABOVE'
 
endas"Margin Categorization"
from my_schema.my_table;

 

 

So your SQL should be sth like this (not tested as I dont know what your L refers to!):

 

select

case when $[OCRD."CardType"] in ('L') then '58'

else null

end

from DUMMY;

 

 

A tested simple example would be:

 

select

case when 'L' in ('L') then '58'

else null

end

from DUMMY;

 

(the "else null" part can be left out if you dont need the else!)


Viewing all articles
Browse latest Browse all 974

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>