There are 2 different types of plsql blocks, Anonymous and Named Block.
- Anonymous block are Subprogramss.
- Syntax of Anonymous block
-- define variables here
-- declare is optional
Begin
-- define the actual logic here
exception;
End;
Example
Declare
v_inum number:=10;
v_outnum number;
Begin
v_outnum=v_inum*10;
dbms_output.put_line(v_outnum);
end;
- Subprograms are named PL/SQL blocks that can have parameters.Functions and procedure are subprograms.
- Syntax :
-- define variables here
Begin
-- define the actual logic here
exception;
End;
Function name is/as
Return Datatype
-- define variables here
Begin
-- define the actual logic here
Return Value;
exception;
End;
No comments:
Post a Comment