Skip to Content
Nov 22, 2014 at 08:48 AM

Questions in HANA Sql


Hi Team,

I have some questions as under:

1)how can i use a dynamic tables/fields in the Cursor definition :

say for eg.., Delcare Cursor Cur_1(dyn_field1 varchar(10), dyn_field2 varchar(10), dyn_table varchar(15)

for select <dyn_field1> <dyn_field2>... <dyn_fieldn> from <dyn_table> ? as it is not acceptable in the Cursor definition to use as:

for select :dyn_field1 :dyn_field2 from :dyn_table ? as it is not acceptable in the Cursor definition to use a Colon(:) before them..

2)how to processing the records fetched from a table type:

say for eg.., if I got a set of records from another procedure that contained a set of records(of a table type)

how to Loop at the records and check for the fields inside them... say I got table that has 5 records and each with 3 fields in it...

after I receive them in the calling procedure, how can Loop at them and check for conditions on the fields... Just like how the

processing will be done in ABAP... Loop at itab into wa_tab.... check the conditions on the fields and Endloop.. ?

3)how to check for dynamic fields while looping in the Cursor records...

say for eg.., if I got 10 records from a stored procedure and I am not aware of the names of the fields in the cursor records

if the code is like: I fetched all the fields from a table which has been derived out of another Cursor...

For tab1 as Cursor_1 do

tab1 has a field called Hana_table and this changes for every cursor loop...

I defined a Cursor_2 as Select * from tab1.hana_table...

Now in the Cursor loop of tab2.... For tab2 as Cursor_2 do

how do I know which fields are there in the Cursor_2 and to process them?

4)how to use Local and Global Internal tables in HANA sql and what is its impact on the HANA tables ?

Please provide answers on the above points as they are very much need for my current development.

Thanks in advance for your inputs.