Home » SQL & PL/SQL » SQL & PL/SQL » Reading a Package
Reading a Package [message #437620] Tue, 05 January 2010 05:05 Go to next message
usman.javaid
Messages: 7
Registered: December 2009
Location: Pakistan
Junior Member

Hi,

Suppose I have a package stored in a database and I want to read the whole package in a variable. Any idea how can i do that?
Re: Reading a Package [message #437623 is a reply to message #437620] Tue, 05 January 2010 05:13 Go to previous messageGo to next message
Michel Cadot
Messages: 63801
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What do you mean read a package?
Do you mean the source code?
If so the query user_source, you can concatenate the value a each line in a variable through a PL/SQL cursor loop.

Regards
Michel
Re: Reading a Package [message #437627 is a reply to message #437623] Tue, 05 January 2010 05:29 Go to previous messageGo to next message
usman.javaid
Messages: 7
Registered: December 2009
Location: Pakistan
Junior Member

Yes, getting the source code. But when i read the source code of the package using user_source i only get the first line of package or only few characters, i want to read the whole package
Re: Reading a Package [message #437638 is a reply to message #437620] Tue, 05 January 2010 05:42 Go to previous messageGo to next message
usman.javaid
Messages: 7
Registered: December 2009
Location: Pakistan
Junior Member

I have a package that have more than 2000 lines of code but in when i query:

select * from dba_objects where object_name like 'MY_PKG' and object_type = 'PACKAGE'

I only get two rows returned with line 1 and 2. Can anybody tell how can i get the whole package???
Re: Reading a Package [message #437641 is a reply to message #437638] Tue, 05 January 2010 05:44 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Please re-read what Michel said...And show us what you tried based on that.Post the result here
You can also select the content into variable from dbms_metadata.

sriram Smile
Re: Reading a Package [message #437643 is a reply to message #437620] Tue, 05 January 2010 06:02 Go to previous messageGo to next message
bishtoo
Messages: 20
Registered: August 2009
Junior Member
Please use Type ='PACKAGE BODY' to check for source code while using user_source.
Probably you are checking package spec only.
Re: Reading a Package [message #437796 is a reply to message #437643] Wed, 06 January 2010 01:09 Go to previous message
usman.javaid
Messages: 7
Registered: December 2009
Location: Pakistan
Junior Member

Thank you bishtoo. It's working now. Cool

Previous Topic: Fixed Width output file
Next Topic: how to compare the columns and return the value thorugh a query? (merged 3)
Goto Forum:
  


Current Time: Sun Sep 25 02:36:53 CDT 2016

Total time taken to generate the page: 0.05022 seconds