Creating stored procedures : Procedure « Function Procedure Packages « Oracle PL/SQL Tutorial

You can store PL/SQL code inside the database.

You could store the following PL/SQL code as a standalone procedure.

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.


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.

27.5.2.A procedure block.
27.5.3.Wrapping a task into a procedure
27.5.4.Storing PL/SQL procedure in the Database
27.5.5.Creating stored procedures
27.5.6.Execute a procedure
27.5.7.Demonstration of a nested procedure block
27.5.8.Create or replace a procedure
27.5.9.Calling a Procedure
27.5.10.Pass ROWTYPE to a procedure
27.5.11.Insert debug line to the stored procedure with DBMS_OUTPUT.PUT_LINE
27.5.12.Listing Stored Procedure Information
27.5.13.Decrease salary with user procedure
27.5.14.Forward Referencing