What Is the Order of Defining Local Variables and Sub Procedures/Functions?
Submitted by: AdministratorIn the declaration part, you must define all local variables before defining any sub procedures or sub functions. See the following sample script:
SQL> CREATE OR REPLACE PROCEDURE WELCOME AS
2 SITE CHAR(80) := 'globalguideline';
3 PROCEDURE WELCOME_PRINT(S CHAR) AS
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('Welcome to ' || S);
6 END;
7 BEGIN
8 WELCOME_PRINT(SITE);
9 END;
10 /
SQL> EXECUTE WELCOME;
Welcome to globalguideline
Notice that variable SITE should be declared before procedure WELCOME_PRINT
Submitted by: Administrator
SQL> CREATE OR REPLACE PROCEDURE WELCOME AS
2 SITE CHAR(80) := 'globalguideline';
3 PROCEDURE WELCOME_PRINT(S CHAR) AS
4 BEGIN
5 DBMS_OUTPUT.PUT_LINE('Welcome to ' || S);
6 END;
7 BEGIN
8 WELCOME_PRINT(SITE);
9 END;
10 /
SQL> EXECUTE WELCOME;
Welcome to globalguideline
Notice that variable SITE should be declared before procedure WELCOME_PRINT
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | What Happens to Indexes If You Drop a Table? |
☺ | How To Recover a Dropped Table in Oracle? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
☺ | What Is Input Buffer in SQL*Plus? |
☺ | How To Invoke the Data Pump Import Utility? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |