creating table using joins in the subquery

can we create a table using joins in the subquery?
Like this
create table emp in select * from employee e, Department d
where d.department_id = e.department_id
??
We can?

987018 wrote:
We can?

Yes, as long as you column alias names common to both tables to make them unique.

SY.

Tags: Database

Similar Questions

  • Creating Tables using the piped cmdlets

    Hi all

    Sorry to do this, but I'm in a hurry nature. I know that I need to read the manual and I intend to do very soon!

    I'm currently building a table or create an output that displays the name of the virtual machine and the NetworkName. I don't know how make the output show both. I implemented the command below, but it only displays the NetworkName. I tried various things, but I can't get the two items will appear...

    Can someone help me? Thank you!!!

    Get-Cluster DEV | Get - VM | Get-NetworkAdapter | Select-Object - property "NetworkName".

    Try something like this

    Get-Cluster DEV | Get-VM |
    Select Name, @{N="NIC";E={$_ | Get-NetworkAdapter | %{$_.NetworkName}}}
    

    If you have more than 1 NETWORK adapter on a virtual machine, you can do

    Get-Cluster DEV | Get-VM |
    Select Name, @{N="NIC";E={[string]::Join(',',($_ | Get-NetworkAdapter | %{$_.NetworkName}))}}
    
  • create table of references to the elements of the array to another

    I was trained by support OR read an array of image files in a table of indicators of the photo and then in order to save memory, establish a table of references in the table of elements "indicators photo so that I can use them in a subsequent loop."    Does anyone know a quick way to create this array of references to a table of indicators of the photo?

    That's what I think is meant by this recommendation, but it was written improperly.  I needed another view of people to him and got him - Thx

  • Create table with data in the column

    Create a new table, just want to know if there is a way to add a new column to the table with a value in all areas of this column when new rows are added to that this column will always be the same value

    As...

    name | address | zip | assets



    Active will always be Yes.
    I do a trigger?

    Use the default...

    create table (test)
    name varchar2 (20).
    address varchar2 (40),
    zip number (7).
    Active VARCHAR2 (3) DEFAULT NULL NOT 'yes');

  • Create table statement will hang the State... in ODI... in the BI database

    Our development team is trying to create an external tabe in the database of another schema. ODI is to create the inside connection bridge. I don't know how. But whenever they get from this request, he'll hang on State. When in the same code works fine in a different database.

    Users whereby they are connceting to the source in the fire database this query have the same privileges.
    For a database, it works fine that the table is created in the target database and in the correct schema but for another, it doesn't work and hung... (not giving any results)

    Databases are used to the BI work and having almost the same configurations.
    I checked the view target database v$ session. It gives me < enq: PS - contention > event
    and three rows are back with < PX Deq: table Q narrow > event for others following two lines...

    is - can anyone shed some light on this? What should I do now. like killing the session blocking is not solve problems


    Here is an example of the executed query:

    CREATE TABLE SCHEMA_NAME. C$ _0ODS_JDE_F0004
    (C1_DTSY, C2_DTUCD1, C3_DTRT, C4_DTJOBN, C5_DTUPMJ_DT, C6_DTMRTY, C7_DTDL01, C8_DTPID,
    C9_DTMRCT, C10_DTLN2, C11_DTCNUM, C12_DTUSEQ, C13_DTUSER, C14_DTCDL, JRN_SUBSCRIBER, JRN_FLAG, JRN_DATE)
    EXTERNAL ORGANIZATION
    (TYPE oracle_datapump
    THE DEFAULT DIRECTORY DIR_SCHEMA_NAME
    LOCATION ("X58030417C$ _0ODS_JDE_F0004_1.EXP", ' X58030417C$ _0ODS_JDE_F0004_2.EXP ')
    )
    2 PARALLEL AS
    SELECT
    NVL (TRIM (F0004. (DTSY), ' ') C1_DTSY, NVL (TRIM (F0004. (DTUCD1), ' ') C2_DTUCD1, F0004. DTRT C3_DTRT,
    TRIM (F0004. C4_DTJOBN DTJOBN), J2DT (DTUPMJ, DTUPMT) C5_DTUPMJ_DT, NVL (TRIM (F0004. (DTMRTY), ' ') C6_DTMRTY;
    TRIM (F0004. DTDL01) C7_DTDL01, TRIM (F0004. DTPID) C8_DTPID, F0004. DTMRCT C9_DTMRCT, F0004. DTLN2 C10_DTLN2,
    F0004. DTCNUM C11_DTCNUM, F0004. DTUSEQ/10 C12_DTUSEQ, TRIM (F0004. C13_DTUSER DTUSER),
    F0004. DTCDL C14_DTCDL, ' ' AS JRN_SUBSCRIBER, 'I' AS JRN_FLAG, SYSDATE AS JRN_DATE
    OF SCHEMA_NAME. F0004 F0004 WHERE (1 = 1)

    -Best regards,.
    Saha

    scratched...

    -saha

  • CFScript to create tables (using MySQL) and configure it to use InnoDB

    I use a cfscript to create my database and the tables using MySQL, and I was able to DO this with success, accept that I'm having a problem. I want to put my tables use InnoDB instead of MyISAM. How to do this?

    That's what I did:

    < cfquery = 'test' datasource name = 'mydatasource' >
    CREATE TABLE Test
    (
    Id int (11) NOT NULL auto_increment,
    Name varchar (20) default NULL,
    Tinyint (4) active default NULL,
    PRIMARY KEY (Id)
    ); ENGINE = InnoDB DEFAULT CHARSET = latin;
    < / cfquery >

    But when I get an error when I run this script. That's what I get:

    -You have an error in your SQL syntax; "check the manual for your version of the MySQL server for the right syntax to use near '; ENGINE = InnoDB DEFAULT CHARSET = latin1'.

    I look and it's the right syntax. Any ideas what I am doing wrong?

    Thanks for any help

    Alfie

    Nevermind, I figured it. I misspelled it.

    ENGINE type = InnoDB... must be before the semicolon.

    :)

  • Export of data from a RDBMS Table to an another RDBMS Table using functions of the ODI

    Hello
    I am facing a problem while exporting a RDBMS table data to an another RDBMS Table using user ODI functions.
    Name:-User_Func
    Group:-training
    Syntax:-User_Func($(SrcField))

    Implementation syntax: -.

    (CASE
    WHEN $(SrcField) > 40000 THEN 'HIGH '.
    WHEN $(SrcField) BETWEEN 30000 AND 40000 THEN 'AVERAGE '.
    OTHER "LOW".
    )
    Technology:-Oracle

    To map the column RANK of my TARGET_EMPTABLE I write
    User_Func (SRC_TABLENAME. SALARY)
    using the Expression Editor.
    I got the following error

    ODI-1227: task failed ODI_FUNC_INTERFACE (export) on the source of ORACLE Source_DataServer connection.
    Caused by: java.sql.SQLSyntaxErrorException: ORA-00905: lack of keyword

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
    at oracle.odi.query.JDBCTemplate.executeQuery(JDBCTemplate.java:189)
    at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:89)
    at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
    at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:70)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:619)
    and in the code tab is: -.

    Select
    SRC_FUNC_TABLE. E_NUMBER E_NUMBER,
    SRC_FUNC_TABLE. E_NAME E_NAME,
    SRC_FUNC_TABLE. E_LOC E_LOC,
    (CASE
    WHEN SRC_FUNC_TABLE. E_SAL > 40000 THEN 'HIGH '.
    WHEN SRC_FUNC_TABLE. E_SAL BETWEEN 30000 AND 40000 THEN 'AVERAGE '.
    OTHER "LOW".
    ) E_GRADE
    of SOURCE_SCHEMA. SRC_FUNC_TABLE SRC_FUNC_TABLE
    where (1 = 1)


    Help, please

    Anindya Chatterjee wrote:
    Hello
    I am facing a problem while exporting a RDBMS table data to an another RDBMS Table using user ODI functions.
    Name:-User_Func
    Group:-training
    Syntax:-User_Func($(SrcField))

    Implementation syntax: -.

    (CASE
    WHEN $(SrcField) > 40000 THEN 'HIGH '.
    WHEN $(SrcField) BETWEEN 30000 AND 40000 THEN 'AVERAGE '.
    OTHER "LOW".
    )

    Your syntax of the CASE statement is not correct
    Missing END keyword
    It should be

    (CASE
    WHEN $(SrcField) > 40000 THEN 'HIGH '.
    WHEN $(SrcField) BETWEEN 30000 AND 40000 THEN 'AVERAGE '.
    OTHER "LOW".
    END)

    Technology:-Oracle

    To map the column RANK of my TARGET_EMPTABLE I write
    User_Func (SRC_TABLENAME. SALARY)
    using the Expression Editor.
    I got the following error

    ODI-1227: task failed ODI_FUNC_INTERFACE (export) on the source of ORACLE Source_DataServer connection.
    Caused by: java.sql.SQLSyntaxErrorException: ORA-00905: lack of keyword

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
    at oracle.odi.query.JDBCTemplate.executeQuery(JDBCTemplate.java:189)
    at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:89)
    at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
    at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:70)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)
    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:619)
    and in the code tab is: -.

    Select
    SRC_FUNC_TABLE. E_NUMBER E_NUMBER,
    SRC_FUNC_TABLE. E_NAME E_NAME,
    SRC_FUNC_TABLE. E_LOC E_LOC,
    (CASE
    WHEN SRC_FUNC_TABLE. E_SAL > 40000 THEN 'HIGH '.


    WHEN SRC_FUNC_TABLE. E_SAL BETWEEN 30000 AND 40000 THEN 'AVERAGE '.
    OTHER "LOW".
    ) E_GRADE
    of SOURCE_SCHEMA. SRC_FUNC_TABLE SRC_FUNC_TABLE
    where (1 = 1)

    Help, please

  • using County in the subquery

    Hello

    I am learning SQL
    I want to know why this query shows several lines instead of only 1 row
    select 
    (select count(*) from employees where hire_date between '31-Dec-1994' and '1-Jan-1996') ,
    (select count(*) from employees where hire_date between '31-Dec-1995' and '1-Jan-1997') ,
    (select count(*) from employees where hire_date between '31-Dec-1996' and '1-Jan-1998') ,
    (select count(*) from employees where hire_date between '31-Dec-1997' and '1-Jan-1999') 
    from employees;
    It displays
    (SELECTCOUNT(*)FROMEMPLOYEESWHEREHIRE_DATEBETWEEN'31-DEC-1994'AND'1-JAN-1996') (SELECTCOUNT(*)FROMEMPLOYEESWHEREHIRE_DATEBETWEEN'31-DEC-1995'AND'1-JAN-1997') (SELECTCOUNT(*)FROMEMPLOYEESWHEREHIRE_DATEBETWEEN'31-DEC-1996'AND'1-JAN-1998') (SELECTCOUNT(*)FROMEMPLOYEESWHEREHIRE_DATEBETWEEN'31-DEC-1997'AND'1-JAN-1999')
    ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             10                                                                             28                                                                             23
                                                                                 4                                                                             
    ............. same kind rows                                                                                                                                            
    
    107 rows selected.
    using oracle 9i
    select
      
    from
      ;

    No where condition to select all rows in the table, then you have 107 lines in your table used.

    You can read the SQL manual

    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/TOC.htm

  • Create table in the select statement.

    Hello Oracle gurus,

    I am creating a table using select * in the other table.

    The procedure I am following is as follows: -.

    I have a temporary table whose signature is on delete rows commit.

    I insert records into this table.

    When I select * from temporary_table, perm_table, I get a few lines.

    so I try to create a result_table the use of this

    CREATE TABLE result_table
    AS SELECT * FROM temporary_table, perm_table;

    I see the created array, but the number of records in 0. Please can someone explain where the validation is performed while the sequence in this query occurs.

    Thank you

    Published by: user10696492 on November 10, 2009 08:47

    Hello

    When you perform DDL like CREATE TABLE implicit validation takes place just before and just after the statement.

    Concerning
    Peter

  • How to specify the tablespace for a India primary key in create table statement

    How to specify the storage space for a primary key index in a create table statement?
    Does the following statement is true?
    CREATE TABLE 'GPS'||TO_CHAR(SYSDATE+1,'YYYYMMDD')
                ("ID" NUMBER(10,0) NOT NULL ENABLE, 
                "IP_ADDRESS" VARCHAR2(32 BYTE), 
                "EQUIPMENT_ID" VARCHAR2(32 BYTE), 
                "PACKET_DT" DATE, 
                "PACKET" VARCHAR2(255 BYTE), 
                "PACKET_FORMAT" VARCHAR2(32 BYTE), 
                "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP, 
                 CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") TABLESPACE "INDEX_DATA"
                 )            
                 TABLESPACE "SBM_DATA";   
    Thank you

    Published by: qkc November 9, 2009 13:42

    As orafad noted, you can use the documentation using ESCALATION clause, i.e.

    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE TABLE GPS
      2              ("ID" NUMBER(10,0) NOT NULL ENABLE,
      3              "IP_ADDRESS" VARCHAR2(32 BYTE),
      4              "EQUIPMENT_ID" VARCHAR2(32 BYTE),
      5              "PACKET_DT" DATE,
      6              "PACKET" VARCHAR2(255 BYTE),
      7              "PACKET_FORMAT" VARCHAR2(32 BYTE),
      8              "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
      9               CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") USING INDEX TABLESP
    ACE "USERS"
     10               )
     11*              TABLESPACE "USERS"
    SQL> /
    
    Table created.
    

    Justin

  • Delete data from a table with joins

    Hey guys,.

    IV struggled for a while with a sql now.
    I'm trying to remove some data from urole based on the www.lesormes.com in the select part.
    The selection is correct, but the part delete Deletes all data in the table urole and not only those found in the select.

    How can I delete all data by using a join?


    DELETE FROM urole
    WHEN THERE IS)
    SELECT *.
    User JOIN urole
    ON user.userid = urole.userid
    AND user.audit_version = urole.audit_version
    JOIN secrole
    ON urole.roleid = secrole.roleid
    WHERE user.audit_current = 'Y '.
    AND secrole.audit_current = 'Y '.
    AND IN secrole.rolename
    ('X',
    « Y »,
    « Z »,
    ));

    Thanks for your help in advance!

    Hello

    Welcome to the forum!

    Chances are, you don't want to join in the subquery EXISTS of EPM; It is more likely you want just like this correlated subqueries:

    DELETE FROM urole
    WHERE  EXISTS (
                      SELECT  0
               FROM    user
               WHERE   user.userid      = urole.userid
               AND     user.audit_version = urole.audit_version
               AND     user.audit_current = 'Y'
               )
    AND    EXISTS (
                      SELECT  0
               FROM    secrole
               WHERE   secrole.roleid         = urole.roleid
               AND     secrole.audit_current = 'Y'
               AND     secrole.rolename          IN ( 'X',
                                                        'Y',
                                          'Z'     -- No comma here
                                           )
               )
    ;
    

    or maybe an IN subquery:

    DELETE FROM urole
    WHERE   p_key  IN
                (
                SELECT  urole.p_key
                FROM    user
                JOIN    urole     ON     user.userid          = urole.userid
                                      AND     user.audit_version      = urole.audit_version
                JOIN    secrole     ON     urole.roleid           = secrole.roleid
                WHERE   user.audit_current     = 'Y'
                AND     secrole.audit_current     = 'Y'
                AND     secrole.rolename      IN ( 'X',
                                                     'Y',
                                       'Z'
                                     )
                )
    ;
    

    where p_key is a unique key (not necessarily a single column) of urole.

    It's just a guess; That's all I can do with the information you have posted. Test this carefully before to try it on your actual data.

    Whenever you have a problem, it allows to post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.
    In the case of a DML (such as DEL) problem, the sample data must re - create the tables as they are to the DML, and the results will be the content of the modified table (urole) after the DML.

    Furthermore, there is a built-in function called user, the user is not a good name for a table.

  • SSRS for lack of outer join with the Oracle data source

    It seems to be a problem with the Oracle driver used in the Reporting SERVICES query designer.

    When you use an Oracle data source, if I create an outer join in the graphic designer, it automatically inserts '{OJ' before the join and '} ' after her.  This is an incorrect syntax for Oracle and refuses to start.  The curly braces and the JO editable in designer text, but if I go back to the graphic designer and immediately to reintegrate them.

    Only, this has started to happen a year or two ago - before that it worked, but with the old (+) syntax.

    Can it not be healed?  It makes things very difficult.

    -Geoff

    Hi Geoff,

    Thanks for posting in the Microsoft Community.

    However, the question you posted would be better suited in the Forums of the Oracle Support; We recommend that you post your query in Oracle Support Forums to get help:

    https://forums.Oracle.com/forums/main.jspa;JSESSIONID=8d92100c30d8fb401bcbd10b46c38c9ddf1a3242549a.e34SbxmSbNyKai0Lc3mPbhmSc3aNe0? CategoryID = 84

    If you have any other questions or you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

  • create table message

    Hello
     create table emp(empno number(5);
    After executing the above create table statement, it shows the message as 'Table created.' in sql * plus window.

    How the message should be displayed. Is there a substantive procedure must be called internally?

    Can someone tell me...

    N ° as John and I answered - the customer decides on what message (if any) to be displayed in response to a running server call.

    On the technical side. The likely sqlplus client uses the standard printf() C command to display "Table created."

    DBMS_OUTPUT is a server software running in an Oracle server process. DBMS_OUTPUT cannot print or display text on a client process. It is simply not possible in the context of the client-server. (the customer does display/print the DBMS_OUTPUT Server data)

  • Creating Tables with a Script

    I am trying to create tables using a script, but it seems that the consecutive statements in the script will not run - someone ' one can tell me what I need to use the syntax?

    ****************************************************************************
    Here is my script - I use SQL-Plus:

    CREATE TABLE parts
    (region_id NUMBER
    NOT NULL CONSTRAINT Region_id_nn
    , region_name VARCHAR2 (25)
    )

    CREATE TABLE countries
    (country_id TANK (2)
    NOT NULL CONSTRAINT Country_id_nn
    , country_name VARCHAR2 (40)
    region_id NUMBER
    CONSTRAINT Country_c_id_pk
    PRIMARY KEY (country_id)
    )
    INDEX OF THE ORGANIZATION

    Here's what I touch in:

    SQL > get c:\oracle\test.txt

    Here is the error that comes out:

    1 parts of CREATE TABLE
    2 (region_id NUMBER
    3 region_id_nn of CONSTRAINT NOT NULL
    4, region_name VARCHAR2 (25)
    5)
    6 countries in CREATE TABLE
    7 (country_id TANK (2)
    8 country_id_nn of CONSTRAINT NOT NULL
    9, country_name VARCHAR2 (40)
    10, region_id NUMBER
    11, CONSTRAINT country_c_id_pk
    12 PRIMARY KEY (country_id)
    13)
    14 * ORGANIZATION INDEX
    15 run;
    CREATE TABLE countries
    *
    ERROR on line 6:
    ORA-00922: missing or not valid option
    ****************************************************************************
    If trim down the script - just 1 create table command, none of the semicolons, this works:

    Script:

    CREATE TABLE parts
    (region_id NUMBER
    NOT NULL CONSTRAINT Region_id_nn
    , region_name VARCHAR2 (25)
    )

    Key in:
    SQL > get c:\oracle\test.txt
    1 parts of CREATE TABLE
    2 (region_id NUMBER
    3 region_id_nn of CONSTRAINT NOT NULL
    4, region_name VARCHAR2 (25)
    5 *)
    SQL > execute;

    Receive:

    1 parts of CREATE TABLE
    2 (region_id NUMBER
    3 region_id_nn of CONSTRAINT NOT NULL
    4, region_name VARCHAR2 (25)
    5 *)

    Table created.
    ****************************************************************************
    adding a semicolon between the instructions in create table does not solve this problem - anyone got any ideas?

    Thank you

    -Tom

    Please see this for more information on the GET sqlplus command.

    http://download.Oracle.com/docs/CD/A97630_01/server.920/a90842/ch13.htm#1009882

    Get command Loads a host operating system file into the SQL buffer.
    
    *The operating system file should contain a single SQL statement or PL/SQL block*.
    The statement should not be terminated with a semicolon. If a SQL*Plus command or
    more than one SQL statement or PL/SQL block is loaded into the SQL buffer from an
    operating system file, an error occurs when the RUN or slash (/) command is used to
    execute the buffer.
    

    I hope it is clear now. So if you want to run a script that may contain more then one of SQL statements, create a file * .sql, put all the instructions, complete with a semicolon and run as follows:

    SQL > @script_name.sql

  • ODCIIndexCreate cannot create table

    Hello world

    I'm trying to implement the example of cartridge power demand. So far everything is compiled correctly, but if I want to use the index 'Create Index' fails because the 'CREATE TABLE' cannot be performed. If I run the 'CREATE TABLE' with sqlplus (as the owner of the cartridge) it works fine, but if I use Create Index (as the owner of the cartridge) it fails. What permissions are required? I've granted to connect and resources the user :(

    Thank you!

    Connect and resources are roles.
    You must grant the user rights directly instead of through roles.
    This link always comes to mind:
    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430

  • Maybe you are looking for