hi Lars,
thanks for your inputs...
I am very much new to HANA and Sql - just 1.5 months into these areas...
well my requirement is as under:
I was given a task to check the differences in the loaded tables in HANA...
1)there is a table(say tab_1) which has 3 fields(say field1, field2 and field3) and field1 refers to a HANA table and field2 and field3 refer to the fields in that HANA table...
2)now I need to read all the records of the table tab_1 and for every record of tab_1, I need to take the HANA table(field1) and get the entries against the fields 2 and 3... this referred HANA table can have multiple records....
3)now I have to check other fields say field4 and field5( of the table tab_1) with that of each and every record obtained against the HANA table entries of the Step(2)...
4)if for any one record of Step(2) matches with the field values of field2 and field3(of tab_1), I need to do some INSERTION into a table...
Dynamic things are:
a)the HANA table might change for each record of records of table tab_1
b)the fields in the HANA table get changed.. need compare field2 with first field of HANA table and field3 with the 2nd record of HANA table...
for this requirement I resorted to Cursors as I am not aware of any other Sql result sets that can be useful in my requirement...
I used the following logic:
For tab1 as cursor_1(fetched fields 1 to 5)
For tab2 as cursor_2(fetched the fields -> from HANA table of cursor_1-hana_table)
Now I created a Local temporary table using EXEC statement as under:
va_sql := 'INSERT INTO #hana_table select "' || tab2.field1 || '" as field1' || ' ' ||
'"' || tab2.field2 || '" as field2 ' || 'from ' || :va_hana_table;
exec (:va_sql);
the Stored procedure was successful, how to read the values present in #hana_table?
I am getting an error:
invalid table name: Could not find table/view #hana_table in schema SYSTEM
if I use as under:
for tab3 as "#hana_table" do
end for;
the error is:
identifier must be declared
I hope the requirement is clear to you... please provide your valuable suggestions...
Regards,
Vishnu