27. 5. 5. Creating stored procedures |
|
You can store PL/SQL code inside the database. |
You could store the following PL/SQL code as a standalone procedure. |
SQL> set SERVEROUTPUT ON
SQL> create or replace procedure p_hello
2 is
3 v_string varchar2(256):='Hello, World!';
4 begin
5 dbms_output.put_line(v_string);
6 end;
7 /
Procedure created.
SQL>
|
|
When the procedure exists in the database, you can easily call the routine and get the same result as before, as shown here: |
SQL> begin
2 p_hello;
3 end;
4 /
Hello, World!
PL/SQL procedure successfully completed.
|
|