I'm new to PL/SQL & would greatly appreciate help in this. I've created a procedure to copy contracts. Now I want to call another procedure from within this procedure which shall copy all the programs related to the contract I'm copying. One contract can have multiple programs.
-
Please read http://stackoverflow.com/help/how-to-ask – Rene Aug 09 '16 at 05:57
-
Pls show your code – Thomas Aug 09 '16 at 06:16
-
Read about private procedures in oracle. You will find the solution. – XING Aug 09 '16 at 06:44
-
1There's no difference whether you call a procedure from within a procedure or from a pl/sql block; if you can call it from a block, you can call it from a procedure. – Aleksej Aug 09 '16 at 06:58
2 Answers
You cal call another procedure in another package by using PackageName.ProcedureName(vcParameters => 'InputParameter1');
If the procedure is in the same package you could do it without the PackageName
, so just ProcedureName(vcParameters => 'InputParameter1');

- 2,415
- 2
- 23
- 36
You call a procedure by simply putting its name and parameters in your code, e.g.
begin
dbms_output.put_line('Demo');
end;
or within a procedure,
create or replace procedure demo
as
begin
dbms_output.put_line('Demo');
end;
I have used dbms_output.put_line
as an example of a procedure, but obviously any other procedure would be called the same way:
begin
foo;
bar(1);
demo(true, 'Bananas', date '2018-01-01');
end;
For some reason, many beginners are tempted to add exec
before the procedure call. I don't know where that comes from because PL/SQL has no such keyword. Possibly they are thinking of the SQL*Plus execute
command, which can be abbreviated to exec
. However, SQL*Plus is a separate command line utility with its own commands that have nothing to do with the PL/SQL language.

- 15,273
- 4
- 38
- 44