-4

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.

Jessie
  • 15
  • 1
  • 1

2 Answers2

0

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');

Tenzin
  • 2,415
  • 2
  • 23
  • 36
0

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.

William Robertson
  • 15,273
  • 4
  • 38
  • 44