Home » SQL & PL/SQL » SQL & PL/SQL » Procedure inside the Package
Procedure inside the Package [message #205505] Sat, 25 November 2006 05:48 Go to next message
balumeignanam
Messages: 8
Registered: November 2006
Location: Bangalore
Junior Member

Hi all,


I have one Package spec that having one procedure

Like ths

proc a is (x in datatype default = 'xyz')

.....
.....
...
end;



In Package body

proc a is (x in datatype default = 'abc')

.....
.....{Statment}
.....
dbms_out.put_line(x)



end packge;
end;



What is out put it display abc or xyz Check it out
Re: Procedure inside the Package [message #205512 is a reply to message #205505] Sat, 25 November 2006 06:06 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
hi,

Quote:
What is out put it display abc or xyz Check it out


what do you think the output should be? i hope you have checked it.

regards,

Re: Procedure inside the Package [message #205538 is a reply to message #205512] Sat, 25 November 2006 09:28 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There won't be any output - you will not be able to create such a package because parameter declared in a package body must match the one in package specification (while, in your example, default values are different).
Re: Procedure inside the Package [message #205549 is a reply to message #205538] Sat, 25 November 2006 18:56 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I think you could compile this under Oracle 8i - I remember we got caught out with some defaults being different between the package spec and body on an upgrade.

I think it will go with the package spec, but I've never tested that.
Re: Procedure inside the Package [message #205569 is a reply to message #205549] Sun, 26 November 2006 03:31 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Tomorrow morning I'll have access to Oracle 8i database and shall try it. Oracle 10 complains about different default values.
Re: Procedure inside the Package [message #205596 is a reply to message #205569] Sun, 26 November 2006 11:54 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Yeah, I think JRowbottom is right; you could do this in 8i (or was it 7?)
I don't know which default will be used, but as dhananjay already pointed out, that would be easy enough to test for the OP.
Re: Procedure inside the Package [message #205609 is a reply to message #205505] Sun, 26 November 2006 14:01 Go to previous message
vshari
Messages: 9
Registered: October 2005
Location: India/UK
Junior Member
Hi,
JRowbottom is right. It works in 8i. It goes with the spec value.


The display would be 'xyz' in this case.

Thanks
Previous Topic: Faulty Script
Next Topic: SQL Query for Parent and child relation
Goto Forum:
  


Current Time: Thu Dec 08 22:23:42 CST 2016

Total time taken to generate the page: 0.28069 seconds