Alternate to DBC.SYSEXECSQL()

General
Enthusiast

Alternate to DBC.SYSEXECSQL()

SET VAR_QUER = 'SELECT COUNT(A1.DTTM) INTO VAR_INS FROM ' ||

                                      VAR_DATABASE || '.' || VAR_TABLE || 

                                      ' A1 WHERE A1.DTTM (DATE) = VAR_DATE ;' ;

CALL DBC.SYSEXECSQL (VAR_QUERY);

When I Execute this within a Stored Procedure I get an error saying 'SQL statement is not supported within a stored procedure'.

I think this is because DBC.SYSEXECSQL() doest not support Select statement.

So What alternative can I use ?

1 REPLY
Enthusiast

Re: Alternate to DBC.SYSEXECSQL()

DBC.SYSEXECSQL() has its limitations. There are few SQL statements which are not supported like SELECT, SELECT...INTO, EXPLAIN etc.

If you want to see the results of the query, you can insert them in a table.