Suppose you have this procedure:
PROCEDURE f (param VARCHAR2)
IS
var VARCHAR2(10);
BEGIN
var := \'hi\';
END f;
I would like to under
The difference is that subprogram headings have formal parameters that are replaced with actual parameters when the subprogram is called:
create or replace function f(
p_x in varchar2 /* a formal parameter */
,p_y in varchar2 /* a formal parameter */
) return varchar2 /* a formal parameter */
is
begin
return p_x || p_y;
end;
declare
v_z varchar2(10);
v_x constant varchar2(1) := 'X';
begin
v_z := f(v_x, 'Y'); /* actual parameters */
end;
The formal parameter is unconstrained (but constrained subtypes can be used) and includes also information about parameter mode and possible default value that are not relevant when a variable is declared.
The datatypes of formal and actual parameters have not to be the same but compatible.
There is plenty of other details too but they can be read from chapter PL/SQL Subprograms of PL/SQL Language Reference. See expecially Subprogram Parameters.
I don't know why the formal parameters have to be unconstrained but I'm a quite happy with that as it removes (unnecessary) details from a subprogram header making it a bit more abstract.