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

how to use case expression? : Sql dba

551


What is orm in sql?

537


Why truncate is faster than delete?

565


Is record in oracle pl sql?

533


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

644






what are the different tables present in mysql? : Sql dba

504


What is an inner join sql?

547


how to check myisam tables for errors? : Sql dba

604


How many scalar data types are supported in pl/sql?

524


What are sql commands?

505


What is sql clause?

543


Can we rollback truncate?

541


What is function and procedure in pl sql?

521


how to drop an existing view in mysql? : Sql dba

570


Is join an inner join?

536