Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating table and appending current date in table name

 
nishant vaishnaw
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Iam using below code to creating table and appending current date in table name,But it's giving error :

COLUMN today_col NEW_VALUE today;
SELECT TO_CHAR ( SYSDATE, 'DDMMYYYY') AS today_col FROM dual;
CREATE TABLE VALID_NUMBE_&today AS (SELECT * FROM VALID_NUMBER);

it giving error "object allready exist"
Please guide hw we can clear the variable value before declaring.
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do take out time to CarefullyChooseOneForum
This forum is for Tomcat questions. Moving...
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I personally would use PL/SQL, not SQL*plus scripts, for this kind of functionality. Probably a stored procedure that would check that the table doesn't exist yet and then created it. The SQL*plus scripting language makes it quite difficult to correctly catch and handle all kinds of possible errors.

In Oracle, it is not quite common to create daily tables. Partitioning is usually used for that, which allows practically the same functionality without exposing the fact that the table is physically organized on daily basis to the application(s). However, partitioning is a feature that has to be bought extra, you can see whether it is supported in your database by running:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic