See https://www.imooc.com/learn/370
Oracle stored procedures, stored functions
Description: stored procedures, stored functions are objects. Comprising a table, view,
index, sequence, and the like are synonyms object.
Concept: refers to memory for user programs, all subroutine calls in a database called stored
procedures, stored functions.
Features: Complete a specific function of the program.
Difference: a storage function can return a value obtained by the return clause.
Create and use stored procedures
to build stored procedures and stored functions using create procedure command.
Syntax:
the Create [or the replace] Procedure procedure name (parameter list)
AS PLSQL subroutine body;
Note: You can only create a stored procedure or replacement can not be modified. Wherein, PL
SQL subroutine of the description.
create [or replace] procedure procedure name (parameter list)
AS
---- declaration section is equivalent to declare can not be omitted
;
eg:
create [or replace] procedure sayhello( )
as
---- declaration section is equivalent to declare can not be omitted
begin
dbms_output.put_line("helloworld");
end
;
transfer
exec sayhello( );
or
begin
exec sayhello( );
exec sayhello( );
end;