Create Table - SqlPlus

Hi
I created a user ME
>>
Create user ME
Default tablespace Users
Temporary tablespace temp;
>>
I connected to ME
If I create a table:
>>
CREATE TABLE projects (
deptno NUMBER(3,0) PRIMARY KEY,
dname VARCHAR2(15),
loc VARCHAR2(25))
TAVBLESPACE users;
>>
Should I see the table projects in the User tables in SQl Developer??
Do I need to add it??

SQL> select table_name from user_tables;
TABLE_NAME
CUSTOMER
DEMO_TEST
DEMO_TEMP
EMP1
FLASHBACK_VERSION_QUERY_TEST
FLASHBACK_QUERY_TEST
FLASHBACK_DROP_TEST
DEPT
EMP
BONUS
SALGRADE
SYS_TEMP_FBT
JEDB_ARCHIVE
+13 rows selected.+
SQL> create table test (empnname varchar2(30),empnum number);
Table created.
SQL> select table_name from user_tables;
TABLE_NAME
CUSTOMER
DEMO_TEST
DEMO_TEMP
EMP1
FLASHBACK_VERSION_QUERY_TEST
FLASHBACK_QUERY_TEST
FLASHBACK_DROP_TEST
DEPT
EMP
BONUS
SALGRADE
TEST
SYS_TEMP_FBT
JEDB_ARCHIVE
+14 rows selected.+
you should be able to see ... see above example.
Anil Malkai
Edited by: Anil Malkai on Mar 1, 2010 2:46 AM

Similar Messages

  • Problems on creating table under schema for BPM Demo project

    hi,
    i have not enough experience in database concepts, but i can create ,insert and modify the tables and data by using SQL query in oracle database 10 g express edition
    The reason behind send this qurery is i wanted to create the database tables under "Quote" schema., which is necessary to store and retrive data for my BPM demo project.
    Two important . Sql scirpt file namely create_user.sql and quote.sql used to create the database tables under "quote" schema available on e:/bpm/sql
    i could create "quote" schema by this command on commandline,
    >cd e:/bpm/sql
    >sqlplus sys/welcome as sysdba @create_user.sql quote quote
    but when creating database tables under "quote" schema , i got "SP2-0734 - unknown command exception thrown
    in commandline i was used like this to create table,
    >sqlplus quote quote @quote.sql
    Can anyone who familiar with database query concept help me to create tables on "quote " schema,
    thanks in advance

    Hello,
    Please find enclosed a complete chapter about the CREATE TABLE statement:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2095331
    At the end there're many examples.
    Hope this help.
    Best regards,
    Jean-Valentin

  • SQLPLUS - Create Table statement

    Hello gents/ladies.
    I have a few tables that I want to import from a DUMP file I have from MySQL. My quickie question : I've removed all the MySQL specific formatting ( I thought ) like Type=MYISAM and similar, and ended up with a CREATE TABLE statement that looks like this:
    CREATE TABLE customerdetails (
    custid NUMBER(11) NOT NULL auto_increment,
    uid_system varchar2(20) NOT NULL default '',
    pwd_system varchar2(20) NOT NULL default '',
    lastname varchar2(30) NOT NULL default '',
    firstname varchar2(30) NOT NULL default '',
    middleinitial char(1) default NULL,
    day_phone_countrycode char(3) default NULL,
    day_phone_main varchar2(16) default NULL,
    evening_phone_countrycode char(3) default NULL,
    evening_phone_main varchar2(16) default NULL,
    email_primary varchar2(80) NOT NULL default '',
    email_secondary varchar2(80) default NULL,
    street_adress varchar2(80) NOT NULL default '',
    state_prov char(3) NOT NULL default '',
    zipcode varchar2(11) NOT NULL default '',
    countrycode char(3) NOT NULL default '',
    PRIMARY KEY (custid),
    UNIQUE KEY UC_custid(custid),
    UNIQUE KEY IDX_system_uid(uid_system),
    KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
    KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
    I get this error back from SQLPLUS:
    CREATE TABLE CUSTOMERDETAILS (
    ERROR in line 1:
    ORA-00922: missing or invalid option
    I've read through the documentation, and can't see what I'm missing here. Could somebody PLEASE point out the obviously screaming error in this statement?
    Thanks!
    Kind regards,
    Henning Kilset Pedersen
    Funcom OSLO AS

    Hi Henning Pedersen,
    First of all the your query syntax is wrong.
    1. the keyword you used "auto_increment" is not in oracle. you need to take it out from query.
    2. you are saying some columns are not null but giving default value as '' (two quotes without any space), this is contradiction, since '' is null, this gives you an error.
    Need to take it out.
    3. the keyword UNIQUE KEY is wrong you need to use only UNIQUE.
    4. Another option is not correct it UNIQUE KEY IDX_system_uid(uid_system),
    it must be UNIQUE (uid_system)
    5. There is not any keyword as a KEY in oracle. you need to take it out from the query too.
    The final query will be like :
    CREATE TABLE customerdetails (
    custid NUMBER(11) NOT NULL ,
    uid_system varchar2(20) NOT NULL ,
    pwd_system varchar2(20) NOT NULL ,
    lastname varchar2(30) NOT NULL ,
    firstname varchar2(30) NOT NULL ,
    middleinitial char(1) default NULL,
    day_phone_countrycode char(3) default NULL,
    day_phone_main varchar2(16) default NULL,
    evening_phone_countrycode char(3) default NULL,
    evening_phone_main varchar2(16) default NULL,
    email_primary varchar2(80) NOT NULL ,
    email_secondary varchar2(80) default NULL,
    street_adress varchar2(80) NOT NULL ,
    state_prov char(3) NOT NULL ,
    zipcode varchar2(11) NOT NULL ,
    countrycode char(3) NOT NULL ,
    PRIMARY KEY (custid),
    UNIQUE (custid),
    UNIQUE (uid_system)---,
    ---KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
    ---KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
    This would work fine.
    Thanx
    Arvind.
    null

  • SQLPLUS define  variables for creating table.

    I am doing the following in SQLPLUS
    define l_date = to_char(sysdate,'yyyy')
    define l_name = "'mytable'"
    define l_tn = &l_name||&l_date
    SQL> select &l_name||&l_date from dual;
    old 1: select &l_name||&l_date from dual
    new 1: select 'mytable'||to_char(sysdate,'yyyy') from dual
    'MYTABLE'||
    mytable2010
    But when I use in this way I don't get YEAR.
    SQL> select '&l_tn' from dual;
    old 1: select '&l_tn' from dual
    new 1: select 'mytable' from dual
    'MYTABL
    mytable
    I want to create table in sqlplus using the following command:
    create table &l_tn(x number)
    Please let me know what I am doing wrong here.

    Hi,
    SQL functions (like TO_CHAR) and operators (like ||) are not executed in SQL*Plus commands (like DEFINE).
    Test your variables after defining them; you'll see what I mean
    define l_date = to_char(sysdate,'yyyy')
    PROMPT     &l_date = l_dateOutput:
    to_char(sysdate,'yyyy') = l_dateThat is, l_date is being set to a 23-character string, which starts with 't' and contains '(', ',' and ')', all of which are illegal in file names (probably; system-dependent).
    I think you wanted it set to a 4-character string, such as '2010'.
    Use the COLUMN ... NEW_VALUE (or ... OLD_VALUE) command to set a substitution variable to the results of a SQL calculation.
    I think you're trying to do something like this:
    COLUMN     year_col     NEW_VALUE     l_date
    SELECT     TO_CHAR (SYSDATE, 'YYYY')     AS year_col
    FROM     dual;
    define l_name = mytable
    CREATE TABLE  &l_name&l_date
    ...

  • While creating Table it shows error as 'missing or invalid option

    I had log on to ap/ap@vis in sqlplus and try to create table but showing error.....here below is the table
    Create table Purchase_Order
    (Item varchar2(10),
    Item_Desc varchar2(100),
    Item_Cost Number(7),
    Item_Qty Number(7),
    Item_Date Date,
    Need_by_date date,
    Last_updated_date date,
    last_updated_by number(10),
    creation_date date,
    created_by number(10),
    Attributed_category varchar2(100),
    attribute1 varchar2(100),
    attribute2 varchar2(100),
    attribute3 varchar2(100),
    attribute4 varchar2(100),
    attribute5 varchar2(100),
    attribute6 varchar2(100));
    But it showing error as ORA-00922:missing or invalid option

    It works for me
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> Create table Purchase_Order
      2  (Item varchar2(10),
      3  Item_Desc varchar2(100),
      4  Item_Cost Number(7),
      5  Item_Qty Number(7),
      6  Item_Date Date,
      7  Need_by_date date,
      8  Last_updated_date date,
      9  last_updated_by number(10),
    10  creation_date date,
    11  created_by number(10),
    12  Attributed_category varchar2(100),
    13  attribute1 varchar2(100),
    14  attribute2 varchar2(100),
    15  attribute3 varchar2(100),
    16  attribute4 varchar2(100),
    17  attribute5 varchar2(100),
    18  attribute6 varchar2(100));
    Table created.
    SQL>

  • Create table in Database Under Creating Direct Database Request in Answers

    When creating the table, I got the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 955, message: ORA-00955: name is already used by an existing object at OCI call OCIStmtExecute: CREATE TABLE AGG_PRODUCTS_CATEGORY_D AS (SELECT DISTINCT PROD_CATEGORY_ID ,PROD_CATEGORY ,PROD_TOTAL_ID ,PROD_TOTAL FROM PRODUCTS) . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL "SH"."Connection Pool" CREATE TABLE AGG_PRODUCTS_CATEGORY_D AS (SELECT DISTINCT PROD_CATEGORY_ID ,PROD_CATEGORY ,PROD_TOTAL_ID ,PROD_TOTAL FROM PRODUCTS)
    SQL Statement:
    CREATE TABLE AGG_PRODUCTS_CATEGORY_D
    AS
    (SELECT DISTINCT PROD_CATEGORY_ID
    ,PROD_CATEGORY
    ,PROD_TOTAL_ID
    ,PROD_TOTAL
    FROM PRODUCTS);
    Connection Pool: "SH"."Connection Pool"
    The above sql statement works when creating the table in SQLPlus. Is there a syntax error when trying to do it in Answers? I don't use the semi-colon at the end in Answers. Thanks.
    Edited by: whoknows on May 24, 2010 1:55 PM

    look at your physical layer in the RPD you'll find that the does table exist (easy to find, it's represented by an icon in red) and you need to drop it before running your aggregate.
    Fiston

  • Stored procedure for creating tables

    Is it possible to create a stored procedure which only contains create tables? I prepare everything on an environment and want to transfer everything, except the data, on anothe environment. Therfore I thought of an stored procedure which does everything automatically. Additional I want to create a package which contains all necessary stored procedures (which are already finished). Is it better to insert the create-table-lines in the package?
    Thanks for your help!

    PL/SQL is not the appropriate tool for this.
    What does Oracle RDBMS products like Apex use to install? SQL*Plus scripts. A combination of SQL code and anonymous PL/SQL blocks.
    This is also what we use to install any one of a dozen Oracle systems we have developed.. it is as simple as running 'sqlplus "/ as sysdba" @installer <tablespace> <schema> <password>'.
    Trying to do this type of thing in PL/SQL... lots of disadvantages, lots of complexities, and very little (if any) benefit.

  • Error Creating Table

    Using Oracle XE.
    I'm trying to create a table and getting the following error:
    ORA-00904: : invalid identifier
    I've created other tables without problems.
    My syntax for the table creation script is:
    create table tna (
    idtna int not null constraint idtna primary key,
    idperson int,
    empnumb char(30),
    surname char(50),
    forenames char(50),
    company char(30),
    dept char(30),
    area char(30),
    location char(50),
    dob DATE,
    trade char(75),
    shift char(75),
    target char(75),
    status char(50),
    tcost NUMBER(9,2),
    approved int,
    attained DATE,
    provider char(75),
    identified char(100),
    reassess DATE,
    user_ char(20),
    createdate DATE,
    amenddate DATE,
    site_code char(30),
    idgenrisk int,
    person_site_code char(30),
    req_by DATE);
    Can anyone see where I'm going wrong?

    Try that in sqlplus, and you get this result:
    create table tna (  2  idtna int not null constraint idtna primar
      3  idperson int,
      4  empnumb char(30),
      5  surname char(50),
      6  forenames char(50),
      7  company char(30),
      8  dept char(30),
      9  area char(30),
    10  location char(50),
    11  dob DATE,
    12  trade char(75),
    13  shift char(75),
    14  target char(75),
    15  status char(50),
    16  tcost NUMBER(9,2),
    17  approved int,
    18  attained DATE,
    19  provider char(75),
    20  identified char(100),
    21  reassess DATE,
    22  user_ char(20),
    23  createdate DATE,
    24  amenddate DATE,
    25  site_code char(30),
    26  idgenrisk int,
    27  person_site_code char(30),
    28  req_by DATE);
    identified char(100),
    ERROR at line 20:
    ORA-00904: : invalid identifier
    Identified is obviously a reserved word.
    C.

  • Do I need to install Oracle database 12c on PC to create tables for Weblogic server

    Hi,
    I am new to WebLogic and I am following a book Java EE Development
    with Eclipse published by PACKT Publishing to learn  Java EE.  I have installed Oracle Enterprise Pack for Eclipse
    on the PC and I am able to log into the WebLogic Server
    Administration Console and set up a Data Source.  However the next step is to create
    tables for the database.  The book says that the tables can be
    created using SQL script run from the SQL command line.
    I cannot see any way of inputting SQL script into the WebLogic
    Server Admistration Console.  Aslo there is no SQL Command line
    in DOS.
    I have put a previous question on the Oracle Forum about the above and I  was advised to use SQL Plus
    to create the tables for the weblogic server but no mention was made of installing Oracle database.
    I have downloaded InstantClient SQL Plus and Instantclient Basic on a PC and
    put the files into the same directory C:\SQLPlus but now I am having a problem in that it is
    looking for a username and password when I run the sqlplus.exe file.
    Now I assume that I need to have an installation of Oracle databse on the
    PC so as to be able to use SQL Plus.  Am I correct in this or can I create tables for the
    datasource in weblogic without an Oracle database?
    Thanks in advance for your help. Brian

    You should install it separately and also need to change the OBIEE's user.sh to tell it where is your Oracle client installed.

  • Drop tables // sqlplus scripts comments // synonyms

    Hello,
    I'm several question:
    1) I've created three tables just as you can look bellow-->
    CREATE TABLE IDIOMA_FABRICANT (
    IDIOMA NUMBER(38) NOT NULL,
    FABRICANT NUMBER(38) NOT NULL,
    WEB VARCHAR(35),
    DESCRIPCIO VARCHAR(100),
    CONSTRAINT idioma_fabricant_pk PRIMARY KEY (IDIOMA,FABRICANT),
    CONSTRAINT idioma_fabricant_fk FOREIGN KEY (IDIOMA) REFERENCES IDIOMA(CODI) ON DELETE CASCADE,
    CONSTRAINT fabricant_fabricant_fk FOREIGN KEY (FABRICANT) REFERENCES FABRICANT(CODI) ON DELETE CASCADE
    CREATE TABLE IDIOMA (
    CODI NUMBER(38),
    DESCRIPCIO VARCHAR(15),
    CONSTRAINT codi_idioma_pk PRIMARY KEY (CODI)
    CREATE TABLE FABRICANT (
    CODI NUMBER(38),
    NOM VARCHAR(30),
    ALIAS VARCHAR(30),
    CONSTRAINT codi_fabricant_pk PRIMARY KEY (CODI)
    question: If I want drop these tables, Do I Must drop firstly the CONSTRAINTS?
    What should the commands to drop these tables are?
    2) I've read that to set comments in my PL/SQL scripts I must type /* ... */ or --. But It doesn't work. The lines inside these characters are performed by SQLPlus. What are the correct characters to establish a comment in my scripts?
    3) While somebody is creating a database tables for your application, he usually executes this sentence "SELECT TABLE_NAME FROM USER_TABLES" to get the tables that he has created. How can I create a synonym to do it more quickly?
    Thanks for all in advance.

    Hi
    We can create Synonym only for giving alternative name for tables, view, sequence, procedure, stored function, package etc.. not like that you said.
    Synonyms are used to hide the name and owner of an object and for providing location transparency for remote objects.
    for example
    Let EMP be the table name.
    If you execute the query given below, then the synonym EMPS will be created for the table name EMP.
    Create synonym EmpS for Emp;
    So now, you can use the synonym name in DML instead of the table name.
    select * from Emps;
    Regards
    Basheer

  • Create table help

    I am very new to Oracle and just installed it on my linux machine. I have a text file with all the create table statements that I need in it. I tried the following to load it but got a few errors
    sqlplus user/pass <createtable.txt
    When I tried entering the first create table statement by hand it worked. With oracle how should I load the statements into sqlplus?
    Thanks

    Hi
    SQLPlus is universal tool and it works on many platforms. Redirecting of standard input and output files is specific unix feature (sqlplus dosenot read from stdin). Try
    sqlplus user/pass @createtable.txt
    Regards
    null

  • Probelms createing table as sysdba...

    On Oracle 9.2.06 on HP-UX, I'm running sqlplus "/ as sysdba" and trying to create thi table:
    CREATE TABLE CUSTOM.AUDIT_TRANS_DUMP_201110
    (dstrct_code varchar(4),
    process_date varchar(8),
    transaction_no varchar(11),
    userno varchar(4),
    rec900_type varchar(1),
    rec900_type_desc varchar(50),
    tran_type varchar(3),
    tran_desc varchar(50),
    tran_group_key varchar(28),
    line_no varchar(4),
    account_code varchar(28),
    cost_center varchar(10),
    batch_no varchar(10),
    creation_date date,
    creation_time varchar(6),
    full_period varchar(6),
    debit_amt number,
    credit_amt number,
    j_description varchar(40),
    currency varchar(4),
    creation_user varchar(10),
    created_by varchar(80),
    appr_user varchar(10),
    appr_by varchar(80))
    TABLESPACE USERS
    NOLOGGING
    NOPARALLEL
    NOCACHE;
    When I log on as / sysdba - aren't I logged on as SYS which should be able to create a table?
    I'm getting this error.

    user13716252 wrote:
    On Oracle 9.2.06 on HP-UX, I'm running sqlplus "/ as sysdba" and trying to create thi table:
    CREATE TABLE CUSTOM.AUDIT_TRANS_DUMP_201110
    (dstrct_code varchar(4),
    process_date varchar(8),
    transaction_no varchar(11),
    userno varchar(4),
    rec900_type varchar(1),
    rec900_type_desc varchar(50),
    tran_type varchar(3),
    tran_desc varchar(50),
    tran_group_key varchar(28),
    line_no varchar(4),
    account_code varchar(28),
    cost_center varchar(10),
    batch_no varchar(10),
    creation_date date,
    creation_time varchar(6),
    full_period varchar(6),
    debit_amt number,
    credit_amt number,
    j_description varchar(40),
    currency varchar(4),
    creation_user varchar(10),
    created_by varchar(80),
    appr_user varchar(10),
    appr_by varchar(80))
    TABLESPACE USERS
    NOLOGGING
    NOPARALLEL
    NOCACHE;
    When I log on as / sysdba - aren't I logged on as SYS which should be able to create a table?
    I'm getting this error.what error?

  • ODCIIndexCreate cannot create table

    Hi everybody,
    I'm trying to implement the Power Demand Cartridge Example. So far everything is compiled fine, but if I want to use the index the "Create Index" fails because the "CREATE TABLE" cannot be executed. If I run the "CREATE TABLE" with sqlplus (as the cartridge owner) it works fine, but if I use Create Index (as the cartridge owner) it fails. What permissions are necessary? I granted connect and resource to the user :(
    Thanks!

    Don not underestimate the Power Of Oracle Docs ;-)
    It's all described here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10765/pwr_example.htm#i1005282
    Example 15-1 How to Create a Database User for the Power Demand Cartridge
    set echo on
    connect sys/knl_test7 as sysdba;
    drop user PowerCartUser cascade;
    create user PowerCartUser identified by PowerCartUser;
    -- INITIAL SET-UP
    -- grant privileges --
    grant connect, resource to PowerCartUser;
    grant create operator to PowerCartUser;
    grant create indextype to PowerCartUser;
    grant create table to PowerCartUser;

  • Error while creating table

    Hi,
    I am getting an error while creating a table,
    create table cs_temp_xml_data as select rowid RW_ID, value(d).getClobVal() xml_value FROM cs_tmp_wcl_xml_data p,table(xmlsequence(extract(p.xml_data,'/records/record'))) d ;
    Here cs_tmp_wcl_xml_data contains a data of 600 mb in oracle directory
    ORA-04030: out of process memory when trying to allocate 4000 bytes (qmxlu subheap,qmemNextBuf:alloc)
    Can anyone help me out regarding this error?

    check out metalink doc: 543239.996
    also bug 3436395.

  • Error while creating table from csv file

    I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
    ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
    Any idea?

    I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
    ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
    Any idea?

Maybe you are looking for