Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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



can use the following like overloading concept in a single package: procedure p1(a varchar), p..

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

can use the following like overloading concept in a single package: procedure p1(a varchar), p..

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

can use the following like overloading concept in a single package: procedure p1(a varchar), p..

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

can use the following like overloading concept in a single package: procedure p1(a varchar), p..

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

can use the following like overloading concept in a single package: procedure p1(a varchar), p..

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

Post New Answer



More SQL PLSQL Interview Questions

can use the following like overloading concept in a single package: procedure p1(a varchar), procedure p1(a varchar2), procedure p1(a char)

5 Answers  


How many databases can sql express handle?

0 Answers  


What is interval partition?

0 Answers  


How do you update sql?

0 Answers  


How can u find column name from a table which have max value in a row.( not max value)

5 Answers  






How to pipe multiline string to isql?

0 Answers  


I have following column in the table. col1 1 a b c 2 3 d and I want to display it as num chars 1 a 2 b 3 c 4 d numbers in one column and letters in another column.

1 Answers   IBM, Saama Tech,


how can we know the number of days between two given dates using mysql? : Sql dba

0 Answers  


Why function is used in sql?

0 Answers  


What does select count (*) mean in sql?

0 Answers  


describe transaction-safe table types in mysql : sql dba

0 Answers  


What is a memo field?

0 Answers  






Categories