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!

Primary Key in Create as Select

684479Apr 9 2009 — edited Apr 9 2009
In Oracle, how do we specify a primary key in a create as select statement? I ran a simple statement but received the ORA-00933 error. Do I have to make it two steps with table created first and do alter table to add the key?

Thanks,



CREATE TABLE Test as
SELECT
*
FROM Source a
WHERE a.sys=100
CONSTRAINT PK1 PRIMARY KEY (AccountID)
This post has been answered by MichaelS on Apr 9 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Apr 9 2009
8 comments
1,457 views