Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Into Using Dynamic Table Name?? 1

Status
Not open for further replies.

TimboA

MIS
Jul 12, 2001
38
GB
I have a table full of data (called ORIG_DATA) that I need to insert into another table. Depending on which month I do the insert determines the table I insert into (i.e. if I do it in January then I want to insert the data into a table called JAN, if its February then into FEB and so on).

I've written a procedure that uses a parameter at runtime called v_FILEMTH, allowing the month name (JAN, FEB etc) can be entered, but I can't get my INSERT statement to work using the parameter as the table name (i.e. INSERT INTO v_FILEMTH SELECT * FROM ORIG_DATA)

Any idea how I can get this to work ??

Thanks in advance.
 
Have a look at EXECUTE IMMEDIATE.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant/Custom Forms & PL/SQL - Oracle 8i & 9i - Windows 2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top