Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with Scope & Visibility of a Variable in PL/SQL

535608Nov 20 2006 — edited Nov 21 2006
I am trying to implement an anonymous block dealing scope and visibility of PL/SQL Variables.

My Code is here under:

set serveroutp on;
<< OUTER >>
DECLARE v_sal NUMBER(7,2) := 60000;
v_comm NUMBER(7,2) := v_sal *.20;
v_message VARCHAR2(255) := 'ELIGIBLE FOR COMMISSION.';
BEGIN
DECLARE v_sal NUMBER(7,2) := 50000;
v_comm NUMBER(7,2) := 0;
v_total_comp NUMBER(7,2) := v_sal + v_comm;
BEGIN
v_message := 'CLERK NOT ' || v_message;
OUTER.v_comm := v_sal *.30;
DBMS_OUTPUT.PUT_LINE(v_message);
DBMS_OUTPUT.PUT_LINE(v_comm);
DBMS_OUTPUT.PUT_LINE(OUTER.v_comm);
END;
v_message := 'SALESMAN ' || v_message;
--DBMS_OUTPUT.PUT_LINE(v_total_comp);
DBMS_OUTPUT.PUT_LINE(v_comm);
DBMS_OUTPUT.PUT_LINE(v_message);
END;

If I execute the above code in isql*plus its giving the proper result. But if I am using Toad its giving the following error stmts.

Error on line 2
DECLARE
v_sal NUMBER(7,2) := 60000;
v_comm NUMBER(7,2) := v_sal *.20;
v_messag

ORA-06550: line 10, column 5:
PLS-00201: identifier 'OUTER.V_COMM' must be declared
ORA-06550: line 10, column 5:
PL/SQL: Statement ignored
ORA-06550: line 13, column 26:
PLS-00201: identifier 'OUTER.V_COMM' must be declared
ORA-06550: line 13, column 5:
PL/SQL: Statement ignored

And if I am executing the same code in Oracle SQL Developer 1.0.0.15 I am getting the following error

Error starting at line 2 in command:

Error report:
ORA-00600: internal error code, arguments: [12259], [], [], [], [], [], [], []

Can anyone clarify this?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2006
Added on Nov 20 2006
3 comments
532 views