Basic Oracle Concepts and Programming Question:

Download Job Interview Questions and Answers PDF

What Is the Order of Defining Local Variables and Sub Procedures/Functions?

Oracle Database Interview Question
Oracle Database Interview Question

Answer:

In 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

Download Oracle Database Interview Questions And Answers PDF

Previous QuestionNext Question
What Happens If Recursive Calls Get Out of Control?What Is the Difference between Formal Parameters and Actual Parameters?