Ask the Expert

Getting a list of tablespaces

How can I see the list of databases? I know how to create a table using SQL statements, but how can I keep it in a specific database or to create it under a specific database?

    Requires Free Membership to View

It appears to me that you are not using the term "database" in the same manner that Oracle uses this term. The Oracle term you most likely want to use in this context is the term "tablespace." An Oracle tablespace is analagous to SQL Server's database.

To see a list of tablespaces in Oracle, issue the following query:

SELECT tablespace_name FROM dba_tablespaces;

Once you know which tablespace you want to house your table, you can create your table similar to the following:

CREATE TABLE my_table (
   id NUMBER,
   name VARCHAR2(30))
TABLESPACE user_tablespace;

The TABLESPACE clause in the CREATE TABLE command instructs Oracle to place the table in the correct location.

This was first published in July 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: