Hi,
I have two procedures proc1 and proc2.
create or replace procedure proc1(dpt_id number)
begin
select dept_name into dname from department_sect where dept_id=dpt_id;
dbms_output.put_line(dname);
end;
create or replace procedure proc2(dpt_id number)
begin
select sum(mon_amt) into amt from dept_sal where dept_name=dpt_id;
dbms_output.put_line(dept_sal);
end;
My intention is to calculate sum of amount of a particular
id(dpt_id).Before calculating this i want to confirm the
name(dept_name) of that particular
id(dpt_id). if i get correct name(dept_name) from *1^st^ procedure(proc1)* then i want to execute the 2^nd^ procedure.
i tried below, but its not worked... i execute below procedure
create or replace procedure proc1(dpt_id number) as
x number:=0;
y number;
begin
select dept_name into dname from department_sect where dept_id=dpt_id;
dbms_output.put_line(dname||' '||'If this name is correct pls enter 0');
if x=&y then
proc2(dpt_id);
end if;
end;
SQL> /
Enter value for y: 0
old 5: if x=&y then
new 5: if x=0 then
Procedure created.
Smith
4500
During the execution of the
procedure proc1 i want to enter the value for
y, not in creation of procedure.
i.e i want below steps...
SQL> /
Procedure created.
SQL> exec proc1(15);
Smith If this name is correct pls enter 0.
Enter value for y: 0
old 5: if x=&y then
new 5: if x=0 then
4500
How to resolve this?
Thanks