Home » SQL & PL/SQL » SQL & PL/SQL » Creating table using a select statement
Creating table using a select statement [message #19014] Tue, 26 February 2002 01:54 Go to next message
Vidya Anand
Messages: 4
Registered: February 2002
Junior Member
Can we use Order By clause in a select statement while creating a new table
ie Is this statement legal? Create table Table1 as select * from Table2 order by Field1
where <Field1 is a field in Table1>

Is this based on server settings?
This query works on one server and does not work on another server.
I am not able to find the reason for this.
Re: Creating table using a select statement [message #19015 is a reply to message #19014] Tue, 26 February 2002 02:43 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
your query is fine . can u tell what exactly the error is.
Re: Creating table using a select statement [message #19026 is a reply to message #19014] Tue, 26 February 2002 08:19 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Are you sure that both servers are running the same Oracle version?

It sounds like one of the servers is possibly running an older version that does not support the 'order by' clause in CTAS (create table as select).
Re: Creating table using a select statement [message #19037 is a reply to message #19015] Tue, 26 February 2002 19:24 Go to previous messageGo to next message
Vidya Anand
Messages: 4
Registered: February 2002
Junior Member
<can u tell what exactly the error is>
Error
"SQL Command not properly ended"
Re: Creating table using a select statement [message #19048 is a reply to message #19015] Wed, 27 February 2002 01:08 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
hi,

i tried here with 7 and 8i and it is fine.i have not got 8. i have no idea why is it happening.

if u find out the answer, please let me know.

best of luck!!!

cheers
pratap
Re: Creating table using a select statement [message #19073 is a reply to message #19014] Wed, 27 February 2002 08:12 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Yes it will. I don't believe that Oracle 8 supports an order by clause in a CTAS statement.
Re: Creating table using a select statement [message #19081 is a reply to message #19014] Wed, 27 February 2002 10:13 Go to previous message
aish
Messages: 44
Registered: March 2001
Member
Did any body solved this problem .If yes please kindly let me know the answer

Thanks
Aish
Previous Topic: VERY URGENT PLEASE HELP
Next Topic: diff btn rowid and rownum
Goto Forum:
  


Current Time: Sat Apr 20 02:44:36 CDT 2024