You can create a procedure that contains a group of SQL and PL/SQL statements.
Procedures allow you to centralize your business logic in the database.
Procedures may be used by any program that accesses the database.
You create a procedure using the CREATE PROCEDURE statement.
The simplified syntax for the CREATE PROCEDURE statement is as follows:
CREATE [OR REPLACE] PROCEDURE procedure_name [(parameter_name [IN | OUT | IN OUT] type [, ...])] {IS | AS} BEGIN procedure_body END procedure_name;
where
You may pick one of the following modes for each parameter:
SQL> SQL> create or replace procedure hello_world 2 as 3 begin 4 dbms_output.put_line('Hello World!'); 5 end; 6 / Procedure created. SQL> SQL> drop procedure hello_world; Procedure dropped. SQL> SQL>
27.5.Procedure | ||||
27.5.1. | Procedures | |||
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 |