1-2. Executing a Block of Code in SQL*Plus
Problem
You want to execute a block of PL/SQL code within the SQL*Plus command-line utility.
Solution
The solution to this recipe is multitiered, in that executing a block of code in SQL*Plus incorporates at least two steps:
Enter the PL/SQL code into the SQL*Plus utility.
Execute the code block by simply placing a backslash (/) as the last line of code, and then press the Enter key.
The following is an example displaying a code block that has been typed into SQL*Plus:
SQL> BEGIN
2 DBMS_OUTPUT.PUT_LINE('HELLO WORLD');
3 END;
4 /
How It Works
To execute code within SQL*Plus, you simply type the executable block and place a forward slash (/
) after the closing END
. The code will be executed by ...
Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.