Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: Consecutive select statements SQLPLus?

    I have two simple select statements I want to run together in SQLPlus but they just won't.

    For example:

    1 select * from global_name
    2 select user from dual

    Whatever I do terminating either or both lines with a comma I get either ORA_911 error invalid character or ORA-933 SQL Command nnot properly. All errors are marked by * at the end of the line.

    Why won't SQLPlus run these together when each will run perfectly OK on it's own?

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    191
    Hi,
    You can do it but in different way;

    save your both quries in file a.sql

    select * from global_name;
    select user from dual;

    and run this file from sql prompt

    sql>@a.sql

    GLOBAL_NAME
    -------------------------------------
    ORCL.US.ORACLE.COM

    USER
    ------------------------------
    PARAG


    Thanks,
    Pagnint
    (No need to search web before posting new question)

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    this works for me:
    PHP Code:
    select from
    (select from global_name),
    (
    select user from dual); 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Mar 2004
    Posts
    2

    Thanks

    OK, that worked, thank you. (both replies)

    But why won't SQLPlus accept the same stuff from afiedt.buf?

    Andrew.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >But why won't SQLPlus accept the same stuff from afiedt.buf?
    Because that is how it is coded to work.
    There is nothing stopping you from doing the following:
    SQL> !vim sql_script.sql
    SQL> @sql_script

  6. #6
    Join Date
    Feb 2004
    Location
    India
    Posts
    135
    Yes andy you can't give the SQL Statement consecutively beca' INAPPROPRIATE CLAUSE starts in FROM CLAUSE.

    So, u may give us follows

    SELECT ( SELECT USER FROM DUAL ) USER_NAME,
    ( SELECT * FROM GLOBAL_NAME ) GLOBAL_NAME
    FROM DUAL ;

  7. #7
    Join Date
    Jan 2004
    Location
    Sochaux (France)
    Posts
    55
    If you wan to make multi select, you can use this following too
    PHP Code:
    (select from global_name)
    union
    (select user from dual); 
    Code:
    GLOBAL_NAME
    ----------------
    DQA
    INFOQUA.WORLD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •