Results 1 to 3 of 3

Thread: pl/sql block

  1. #1
    Join Date
    Jul 2005
    Posts
    276

    Unanswered: pl/sql block

    Can someone please help me in creating this simple PL/SQL block.

    I need to execute this procedure create('schname','table_name')
    and handle exception when the procedure fails to execute.

    BEGIN
    exec create('schname','tabname');
    EXCEPTION
    when others then
    raise(-20000,'Error in procedure CREATE = '||SQLERRM);
    END;

    I ran the same but was getting errors:
    -----------------------------------------
    Error report:
    ORA-06550: line 2, column 6:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:

    := . ( @ % ;
    The symbol ":=" was substituted for "CREATE" to continue.
    ORA-06550: line 5, column 7:
    PLS-00103: Encountered the symbol "(" when expecting one of the following:

    ; <an identifier> <a double-quoted delimited-identifier>
    ORA-06550: line 5, column 57:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:

    , * & - + / at mod remainder rem <an identifier>
    <a double-quoted delimited-identifier> <an exponent (**)> as
    from into || multiset bulk year DAY_

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    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.

  3. #3
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    You don't need EXEC here because you are in a PLSQL block, so PLSQL context, not SQL context :
    Code:
    BEGIN
        create('schname','tabname');
    EXCEPTION
        WHEN OTHERS THEN
            RAISE(-20000 ,'Error in procedure CREATE = '||SQLERRM);
    END;
    This works provided you have already created the CREATE procedure. BTW always avoid to create stand-alone procedures (except for testing purposes), always group procedures/functions inside packages. This is cleaner and much more easy to manage the EXECUTE rights on packages than on individual procedures.

    Regards,

    rbaraer
    ORA-000TK : No bind variable detected... Shared Pool Alert code 5 - Nuclear query ready .

Posting Permissions

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