Skip to content
Advertisement

Alternative ideas for INTO CLAUSE in DYNAMIC SQL

I just learned,I will not able to use INTO CLAUSE in stored procedure,while using dynamic sql.

Below is my Dynamic SQL.

requirement to use the procedure for multiple queries.

This is how my queries looks a like after passing values.

I have to return the SELECT fields.How do I return value of these fields.These fields and table and query will change.

Advertisement

Answer

I used below code and it working fine. I was able to run multiple select’s using Dynamic.

I pass parm as below. using the where clause HOST_VAR_B as Parameter marker “?” and assigning the field at OPEN.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement