Operating System - HP-UX
1748289 Members
3115 Online
108761 Solutions
New Discussion

Re: Can I use table name as variable in PRO*C/PLSQL?

 
SOLVED
Go to solution
MA Qiang
Regular Advisor

Can I use table name as variable in PRO*C/PLSQL?

EXEC SQL INSERT
INTO tbl_X VALUES (:test_rec);
EXEC SQL COMMIT WORK;

IF tbl_X is a variable, how to set and use it?

Best Regards.
1 REPLY 1
Alex Lavrov.
Honored Contributor
Solution

Re: Can I use table name as variable in PRO*C/PLSQL?

Hey,

It's called dynamic sql. In pl/sql it's easy, but it's a bit more complicated in proc*c.

Here's for Pro*C:
http://www.stanford.edu/dept/itss/docs/oracle/9i/appdev.920/a97269/pc_13dyn.htm

Here's for PL/SQL:
http://www.dulcian.com/magazine%20articles/Execute%20Immediate.htm
(immediate statement)

But remember, heavy use of dynamic sql, can cause performance problems. The switch between static and dynamic sql impacts oerformance.
I don't give a damn for a man that can only spell a word one way. (M. Twain)