‎2008 Nov 02 8:13 AM
Hi folks,
Is it possible to assign a SQL query to a variable, and then using an OPEN statement to read the variable?
E.g.,
query TYPE STRING VALUE 'SELECT * FROM mytable'.
EXEC SQL.
OPEN c1 FOR :query
ENDEXEC.
‎2008 Nov 02 8:30 AM
Host variables are for transferring data from database table to abap program.So i don't think so that we can use for reading the variables
‎2008 Nov 02 8:38 AM
Hi, thanks for the quick reply.
So do you have any idea how to do to open using a variable? This is because my SQL statement needs to be constructed dynamically depending on other data (I am doing string processing before the statement is finalized).
Or is there another way to do this instead of using cursor processing in Native SQL?
Thanks in advance.
‎2008 Nov 03 1:49 AM
OK, I've tried to narrow this length of string down to the following:
data mystring type string.
"SELECT ... ... ... WHERE" ... and then "mystring" needs to be appended to the end of the SQL statement.
E.g., mystring could be " field1 = '1234' AND field2 = 'XYZ' "
Is this possible? Thanks in advance for reading.