Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    19

    Thumbs up Unanswered: Selecting multiple rows USING 'EXECUTE IMMEDIATE'

    I need to use 'copy' command in 'Execute Immediate' but, it fails, as 'Execute Immediate' doesn't support 'selecting multiple rows of data'.

    EXECUTE IMMEDIATE copy from NetService1 to NetService2 append to SCHEMA1.NEW_TABLE using select * from SCHEMA2.NEW_TABLE;

    This is the query that is failing.

    Could you please suggest an alternate way of doing this, if possible, using Execute Immediate ?


    Tia,
    -AI

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    Have you looked at the format for this copy command?

    Compared to the docs your syntax looks wrong at a few levels.

    My book says:
    PHP Code:
    COPY from user/password@sid to user/password@sid
      APPEND to table schema1
    .tablename
        USING select 
    from schema2.tablename

    an alternative would be a dblink and then an insert/select-from
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Feb 2004
    Posts
    19
    Hi,

    I had meant the same syntax which you've mentioned. I just did use 'NetService' in the place of 'user/password@sid'. Anyway, Thanks for the response.

    I am looking for a possibility of using 'Execute Immediate' but eliminating this problem of not being able to do a 'multiple-rows select'. Please let me know if u can help.

    Thanks,
    -AI

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can't get there from here.
    By definition the use of EXECUTE IMMEDIATE means that you are inside of
    a PL/SQL block.
    COPY is a SQL*PLUS command and is NOT a valid SQL statement
    which is what EXECUTE IMMEDIATE requires.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Feb 2004
    Posts
    19
    Thanks for that info.
    I shall now try not using 'Execute Immediate' in this scenario.

    Thanks,
    -AI

Posting Permissions

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