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!

CREATE TABLE for another OWNER/SCHEMA and in another TABLESPACE?

pstein-JavaNetSep 27 2011 — edited Oct 24 2011
I am logged in a SYSTEM user. Now I want to create a table aaa. The owner of this table should not be SYSTEM but user KARL. and the TABLESPACE should not be SYSTEM but the (existing) TABLESPACE tttt.

As far as I know I can achieve this by issuing the following command:

CREATE TABLE KARL.aaa ( a INTEGER, .......) TABLESPACE tttt;

Regarding the TABLESPACE parameter I am not sure. Is it possible to allocate a TABLE for User Karl in a TABLESPACE which is not assigned to him?

Furthermore I have an additional problem.
I have a script with hundreds of CREATE TABLE + ALTER TABLE + CREATE INDEX DDL statements.
All of them are not prepended with Schema/Owner and an TABLESPACE clause.

Can I put somehow one single instruction at the top of the script which telles Oracle
to use
- OWNER Karl as Schema/Owner for all subsequent DDL stements
- TABLESPACE tttt as TABLESPACE for all subsequent DDL stements
?

In MYsql there is a "use <database>" statement. Is there soemthing similar for Oracle?

Thank you
Peter
This post has been answered by 601182 on Oct 24 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2011
Added on Sep 27 2011
11 comments
2,145 views