DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Native dynamic SQL in PL/SQL package

  1. #1
    Join Date
    Nov 2000
    Posts
    71

    Question

    Hi,
    I've this problem.
    I know that with O8i it's possible to use the EXECUTE IMMEDIATE statement for dynamic SQL instead of using DBMS_SQL.
    However when i put this istruction in my package compilation failed. Follow ther is the code nad the error:

    CREATE OR REPLACE PACKAGE BODY package AS

    PROCEDURE proc (
    .............,
    .............,
    errorCode OUT NUMBER,
    errorText OUT VARCHAR2) IS


    EXECUTE IMMEDIATE 'GRANT SELECT ON SDH_PROV_SUPPORT.SPS_AMPLIAMENTO_SCHEDE TO ' || userName';

    EXCEPTION WHEN OTHERS THEN
    errorCode := sqlcode;
    errorText := sqlerrm;
    ............
    ............

    END proc;
    .........
    .........
    END package

    PLS-00103: found the symbol "
    EXCEPTION WHEN OTHERS THEN
    errorCode := sqlcode;
    errorTe" instead of one of the following:
    . ( * @ % & = - + ; < / > at in mod not rem return returning
    <> or != or ~= >= <= <> and or like
    between into using is null is not || is dangling

    Without the EXECUTE IMMEDIATE statement the package compile and work fine.

    Thanks for your suggestion.

  2. #2
    Join Date
    Jan 2001
    Posts
    153
    EXECUTE IMMEDIATE 'GRANT SELECT ON SDH_PROV_SUPPORT.SPS_AMPLIAMENTO_SCHEDE TO ' || userName';

    i donn see anything wrong with the exec immd...check the single quote(') after username which wouldve caused an error
    Vijay.s

  3. #3
    Join Date
    Nov 2000
    Posts
    71

    Talking

    Thanks vbaskar but it was a mistake when i wrote the post.
    However I solved the problem re-writing the package...
    May be an ascii character problem occurred during a cut and paste?
    But now work fine!!

Posting Permissions

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


Click Here to Expand Forum to Full Width