Home » SQL & PL/SQL » SQL & PL/SQL » how can we create table by using another table with some condition (Oracle 10g)
how can we create table by using another table with some condition [message #575650] Fri, 25 January 2013 03:25 Go to next message
umeshchandraseth
Messages: 60
Registered: June 2011
Location: new delhi
Member
hi all,

can we create table with copying of another table with some specific condition.

example.
suppose we have one table which name is emp with three columns.
empid
empname
empjoindate


i want create a table emptemp by using emp table
where empjoindate between two dates.

Regards
Umesh

Thanks all in advance...
Re: how can we create table by using another table with some condition [message #575652 is a reply to message #575650] Fri, 25 January 2013 04:00 Go to previous messageGo to next message
sss111ind
Messages: 480
Registered: April 2012
Location: India
Senior Member

CREATE TABLE emptemp AS
SELECT * FROM emp
WHERE empjoindate>to_date('01-jan-2012')
AND empjoindate  <to_date('01-jan-2013');
Re: how can we create table by using another table with some condition [message #575659 is a reply to message #575652] Fri, 25 January 2013 04:42 Go to previous message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is wrong (once more, you should REALLY verify what you post):
SQL> select to_date('01-jan-2012') from dual;
select to_date('01-jan-2012') from dual
               *
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected

NEVER use TO_DATE without a format.

Regards
Michel
Previous Topic: Table Partitioning
Next Topic: Dynamic %rowtype
Goto Forum:
  


Current Time: Mon Sep 01 13:53:11 CDT 2014

Total time taken to generate the page: 0.06083 seconds