I have a SQL statement that is dynamically created; that is, it is comprised of a static SQL string with some dynamic value appended to it. How do I go about executing this statement? Is there a command for this? This would be equivalent to "EXEC sp_executesql SqlString" in SQLServer.
Also, what is the syntax for looping through a result set? Is there such a command? If so, can you please share an example of this?
What i'm trying to do is:
- Run a SELECT statement
- Loop through the result set to create the SQL string
- Run the SQL string