can use the following like overloading concept in a single
package:
procedure p1(a varchar),
procedure p1(a varchar2),
procedure p1(a char)
Answers were Sorted based on User's Feedback
Answer / vpl
No.
for overloading, parameters must differ by type family--
whereas CHAR, VARCHAR and VARCHAR2 belongs to same family.
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / vpl
No.
for overloading, parameters must differ by type family--
whereas CHAR, VARCHAR and VARCHAR2 belongs to same family.
This will actually allow you to create the pack but will
give run time error.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / bunty
Yes. you can create package where overloading will be
identified by using type of arguments.
Following code will work fine,
--WORK's FINE
create or replace package PK_TEST AS
procedure p1(a IN varchar);
procedure p1(a IN varchar2);
procedure p1(a IN char);
end PK_TEST;
But,following code will not work as p1( v1 IN varchar) and
p1(v3 IN varchar) has the same type of arguments.
--NOT WORK
create or replace package PK_TEST AS
procedure p1(v1 IN varchar);
procedure p1(v2 IN varchar2);
procedure p1(v3 IN varchar);
end PK_TEST;
Cheers,
Bunty
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / sudhakar naraparaju
I created a test package and executed.
create or replace package test is
procedure p1(v1 in Varchar);
Procedure p2(v2 in varchar2);
procedure p3(v3 in char);
end;
/
create or replace package body test is
procedure p1(v1 in Varchar) is
begin
dbms_output.put_line(' The input data for v1 is: '||v1);
end;
Procedure p2(v2 in varchar2) is
begin
dbms_output.put_line(' The input data for v2 is: '||v2);
end;
procedure p3(v3 in char) is
begin
dbms_output.put_line(' The input data for v3 is: '||v3);
end;
end;
/
I called each procedure in sql by setting the serveroutput
on:
begin
test.P3('Testing Procedure P3');
end;
I got the below output:
The input data for v1 is: Testing Procedure P1
The input data for v2 is: Testing Procedure P2
The input data for v3 is: Testing Procedure P3
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / sudhakar naraparaju
I created a test package and executed.
create or replace package test is
procedure p1(v1 in Varchar);
Procedure p2(v2 in varchar2);
procedure p3(v3 in char);
end;
/
create or replace package body test is
procedure p1(v1 in Varchar) is
begin
dbms_output.put_line(' The input data for v1 is: '||v1);
end;
Procedure p2(v2 in varchar2) is
begin
dbms_output.put_line(' The input data for v2 is: '||v2);
end;
procedure p3(v3 in char) is
begin
dbms_output.put_line(' The input data for v3 is: '||v3);
end;
end;
/
I called each procedure in sql by setting the serveroutput
on:
begin
test.P3('Testing Procedure P3');
end;
I got the below output:
The input data for v1 is: Testing Procedure P1
The input data for v2 is: Testing Procedure P2
The input data for v3 is: Testing Procedure P3
| Is This Answer Correct ? | 0 Yes | 1 No |
What does t sql mean?
What is primary and foreign key?
What is example of database?
What is normalization in a database?
What happens if a procedure that updates a column of table X is called in a database trigger of the same table ?
Can you alter start with clause?
What does select * from mean in sql?
Explain how can you save or place your msg in a table?
Is it possible for a table to have more than one foreign key?
when MSQL8.0 is in market
I have done oracle 10g. I need a project knowledge. So if u please send a project how it should be done,Or you can send email link. I will be very grateful to u.
what is called after appearing where clause
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)