Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    6

    Unanswered: Error in EXECUTE IMMEDIATE

    Hi,

    I am facing an issue while trying to run the following command:

    execute immediate 'select 1 into '
    || ln_count
    || 'from tblname'
    || 'where tblcolname in '|| lv_mktplace_str;

    I get the error:

    ORA-00905: missing keyword
    ORA-06512: at "TEST.PROC", line 30
    ORA-06512: at line 1

    Please help!

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Maybe add a blank before "from" and before "where" ?
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  3. #3
    Join Date
    Jun 2007
    Posts
    3
    I agree. seems like a spacing issue? try:

    execute immediate 'select 1 into '
    || ln_count
    || ' from tblname '
    || ' where tblcolname in '|| lv_mktplace_str;

  4. #4
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    Look up the syntax for execute immediate and you will find you dont put the INTO clause in the dynamic string but at the end outside the string.

    EXECUTE IMMEDIATE sqlstr USING <bind variable list> INTO <into var list>

    Alan

Posting Permissions

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