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 do I count rows in sql?

739


What are the two parts of design view?

769


How to start the command-line sql*plus?

743


What does cursor do in sql?

712


give the syntax of grant and revoke commands? : Sql dba

803






How many developers work on postgresql?

734


What makes a good primary key?

729


what is bcp? When is it used?

769


Does a primary key have to be a number?

688


Give the order of sql select?

829


What is the sql*loader? : aql loader

777


What are sql ddl commands?

734


What is full join?

699


Can we create table inside stored procedure?

696


What is a record in pl/sql?

763