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

Thread: simple procedure not running in sqlplus

  1. #1
    Join Date
    Jul 2002
    Posts
    8
    Hello everybody,

    I just created a simple procedure and wanted to execute the
    same in sqlplus.
    Sam_campus is a table but when I run it I get an error that sam_campus is an identifer and needs to be declared.

    I have create any procedure and execute any procedure privileges.

    ***************************
    CREATE or replace PROCEDURE PAD1 IS
    V_CLN VARCHAR(2);
    BEGIN
    SELECT DISTINCT CLN_BUDGET_IND INTO V_CLN FROM SAM.SAM_CAMPUS WHERE CLN_BUDGET_IND = 'Y';
    DBMS_OUTPUT.PUT_LINE('THIS IS A MESSAGE'||V_CLN);
    END;--------I have put the procedure in s.sql
    ****************************************

    SQL> start s.sql
    7 /

    Warning: Procedure created with compilation errors.

    SQL> show errors;
    Errors for PROCEDURE PAD1:

    LINE/COL ERROR
    -------- -------------------------------------------------------------
    4/1 PL/SQL: SQL Statement ignored
    4/48 PLS-00201: identifier 'SAM.SAM_CAMPUS' must be declared

    I don't know why I am getting this error.

    Please help!!!

    Thanks in advance.

    B.regards

    Pad

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    Does the invoker of the procedure have select privileges on the sam schema, specifically the sam_campus table?

    Do you know for sure that distinct cln_budget_ind will return one and no more than one value? What happens if there is more than one distinct cln_budget_ind? Think cursor or record.

    Here I am connected as scott/tiger, and get the same error when I run your create procedure statement:

    SQL> CREATE or replace PROCEDURE PAD1 IS
    2 V_CLN VARCHAR(2);
    3 BEGIN
    4 SELECT DISTINCT CLN_BUDGET_IND INTO V_CLN FROM SAM.SAM_CAMPUS WHERE CLN_BUDGET_IND = 'Y';
    5 DBMS_OUTPUT.PUT_LINE('THIS IS A MESSAGE'||V_CLN);
    6 END;
    7 /

    Warning: Procedure created with compilation errors.

    SQL> show errors
    Errors for PROCEDURE PAD1:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    4/1 PL/SQL: SQL Statement ignored
    4/48 PLS-00201: identifier 'SAM.SAM_CAMPUS' must be declared
    SQL>

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