Home » SQL & PL/SQL » SQL & PL/SQL » DYNAMIC SQL -- How does one dynamically provide the INTO value?
icon9.gif  DYNAMIC SQL -- How does one dynamically provide the INTO value? [message #194084] Wed, 20 September 2006 14:20 Go to next message
nhansen
Messages: 1
Registered: September 2006
Location: Austin, TX
Junior Member
Hi,

I am dynamically trying to populate several tables; therefore I do not know which table until inside the BEGIN....

Once I figure out which table in the loop, I want to select from it, and store the row SOMEWHERE that I may use the values later in the program. How can I dynamically create or point to a %ROWTYPE variable?

For example, I can construct my query, but when I go to execute it, how do I dynamically provide the INTO value?


EXECUTE IMMEDIATE vSQLQuery
--> INTO GetType(vTableID); <-- because I don't know
what it is until I'm there in the loop.

The way everyone at this position has done this in the past if to delete the row if it exists, then insert it. I can get the inserts to work (no brainer), but I don't like the idea of deleting the rows if they exist; I'd rather update them.

Any ideas?
Re: DYNAMIC SQL -- How does one dynamically provide the INTO value? [message #194097 is a reply to message #194084] Wed, 20 September 2006 15:27 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
insert or update first...

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:8004408492566
Previous Topic: Procedure with optional arguement
Next Topic: date range
Goto Forum:
  


Current Time: Fri Dec 02 13:52:37 CST 2016

Total time taken to generate the page: 0.13456 seconds