Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    53

    Unanswered: using execute immediate to populate temporary table

    Can someone tell me how to use execute immediate to populate data into a temp table in an oracle sp?

    This is what Im trying:

    execute immediate ' INSERT INTO equipment
    (serial)
    SELECT sh_serial FROM casemas, schilin
    WHERE (schi_shser = sh_serial)
    and (schi_itemno = ' || itemno || ')' || 'and sh_serial IN (' || cases || ')';
    Thanks!

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    And that doesn't work? Is there some kind of error message?

  3. #3
    Join Date
    Apr 2004
    Posts
    69
    The problem could be due to a mismatch in the number of columns in the table in which you are trying to insert data

  4. #4
    Join Date
    Feb 2004
    Posts
    108
    Quote Originally Posted by awfdml
    and (schi_itemno = ' || itemno || ')' || 'and sh_serial IN (' || cases || ')';
    check out what is being constructed and what are you expecting ...

    and (schi_itemno = 999) and sh_serial IN (9, 9, 9 );

    OR

    and (schi_itemno = '999') and sh_serial IN ('9', '9', '9' );

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    you have no space between your end bracket ")" and your "AND"
    in your last line so you are trying to execute ")and"

    you don't really need the brackets at all but whatever.

    try this on your last line:
    PHP Code:
    and (schi_itemno ' || itemno || ') and sh_serial IN (' || cases || ')'; 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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