Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic Table Name

577178Nov 9 2007 — edited Nov 12 2007
Hi,

I have a SQL script which will create a table, and will be run on a monthly basis. I want to completely automate this script if possible (ie no manual updates). The problem I'm having is trying to dynamically name it.

I want to name the table the previous year month (ie TEST_TABLE_200710).

create table test_table_to_char(trunc(sysdate),'yyyymm')-1 no logging parallel 2 as select * from dual;

The above obviously does not work. I have done a bit of digging and apparently dynamic sql is the way to go. Can anyone confirm if this is the case? Can you recommend any good reading material??

Many thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2007
Added on Nov 9 2007
7 comments
786 views