overloading of stored procedure is possible in oracle?

Answer Posted / vipin kumar

This is how its works

create or replace package vips_test as
function addition(a1 in number, b in number, c1 in number default 0) return number;
function addition(a1 in number, b in number ,d1 in number default 0) return number;
end;
/
show errors;


create or replace package body vips_test as

function addition(a1 in number, b in number, c1 in number default 0)
return number is
begin
dbms_output.put_line('---------------1----------------------');

return a1+b+c1;
end;


function addition(a1 in number, b in number ,d1 in number default 0)
return number is
begin
dbms_output.put_line('---------------2----------------------');

return a1+b+d1;
end;


end;
/
show errors;


select vips_test.addition(a1 => 1 ,b =>2, c1 => 2) from dual;

but if you will try calling as above

select vips_test.addition(a1 => 1 ,b =>2) from dual;

SQL Error: ORA-06553: PLS-307: too many declarations of 'ADDITION' match this call
06553. 00000 - "PLS-%s: %s"

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is index? : Sql dba

554


What does select * from mean in sql?

1979


Why query optimization is needed?

509


What is difference between hql and native sql?

571


How can a function retun more than one value in oracle with proper example?

576






What are analytical functions in sql?

531


Explain the update statement in sql

556


how to delete an existing column in a table? : Sql dba

548


Explain what is table in a database?

569


How we can update the view?

595


What is output spooling in sql*plus?

544


What is the difference between sum and count in sql?

516


What is trigger types in sql?

529


Explain the commit statement.

608


Can you have more than one trigger on a table?

526