Use of CASE Statement in HANA SQL Script

light111Case Statement use in HANA SQL Script


A simple use of CASE statement used in SELECT statement to derive additional computed field/column.

Lets’s look at the SPFLI records. It has a field called FLTYPE(Flight Type). It can be scheduled(‘ ‘) or Charted(X). Based on this field we will derive on more computed field.

1

Here we have a AMDP procedure with  data selection from SPFLI table.

Now look to the first SELECT statement that fills in the table: LT_SPFLI . It has all the fields from SPFLI table with one more computed field called as FLCATEGORY whose value is filled in the CASE statement performed on the field FLTYPE.

2

Test report-

3

Debug Details-

4


 

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s