on 02-20-2018 9:42 AM
The Documentation for Execute Immediate unfortunately does not show how to use the into statement.
So how can i store the result of a dynamic SQL in a variable?
Background:
I need dynamic SQL since the table name and columns are variables like this:
dynSql := 'SELECT max(' || searchColName || ') ' || char(10);
dynSql := dynSql || 'FROM ' || tbl || char(10);
dynSql := dynSql || 'WHERE ' || whereColName || ' = ''' || whereColValue || '''';
execute immediate dynSql;-- into outputValue;
The variable content could be:
select max(TIMESTAMP)
from "SCHEMA"."TABLE"
where "UniqueId" = 'XXX123XX-EA9E-43F4-AB27-104B3E4DXXXX';
So how can i store the value of TIMESTAMP in the output variable of the stored proceedure?
Hello, it is not possible to insert the result in a self-defined temporary table (table_var = EXECUTE IMMEDIATE SQLstring), but if it is possible to insert the result in a declared table, now, this is a great limitation of HANA because it conditions the result of the dynamic query by structure declared in the table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the documentation is already quite clear regarding that (also not providing a code example). But you can check the blog here for an example.
Regards,
Florian
PS: I assume you have already a HANA 2.0 SPS01 system to have this feature supported.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see the blog, but not letting me do it:
EXECUTE IMMEDIATE 'SELECT NEW ST_Point(' || char(39) || 'POINT(' || decEndPointLong1 || ' ' || decEndPointLat1 || ')' || char(39) || ', 4326).ST_Distance( NEW ST_Point(' || char(39) || 'POINT(' || CURRLONG || ' ' || CURRLAT || ')' || char(39) || ', 4326)) FROM DUMMY' INTO dDistEP1;
Any ideas?
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.