If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > how to see text of procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-06-02, 11:42
nsandya nsandya is offline
Registered User
 
Join Date: Oct 2002
Posts: 11
how to see text of procedure

Can some one please tell me how to see the text or code of procedure.
assume that i have procedure calculate sal.


I want to view the code of that procedure for modification..
Thanks,
san
Reply With Quote
  #2 (permalink)  
Old 11-06-02, 11:54
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: how to see text of procedure

Quote:
Originally posted by nsandya
Can some one please tell me how to see the text or code of procedure.
assume that i have procedure calculate sal.


I want to view the code of that procedure for modification..
Thanks,
san
The code is in USER_SOURCE if you created the procedure, or ALL_SOURCE if someone else did (but then you may not be able to read it).

SELECT text
FROM user_source
WHERE name = 'MYPROC'
and type = 'PROCEDURE'
ORDER BY line;
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 11-09-02, 17:09
clio_usa clio_usa is offline
Registered User
 
Join Date: Apr 2002
Location: California, USA
Posts: 482
Cool

In Oracle 9i you can use DBMS_METADATA package. It is making DDL extraction a snap even for tables DDL. An example is:

set pagesize 0
set long 90000

execute DBMS_METADATA.SET_TRANSFORM_PARAM(
DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);

SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
FROM USER_ALL_TABLES u
WHERE u.nested='NO'
AND (u.iot_type is null or u.iot_type='IOT');

execute DBMS_METADATA.SET_TRANSFORM_PARAM(
DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');

It will get you the DDL for all "complete" tables in the current schema, filtering out nested tables and overflow segments.

For procedure body use 'PROCEDURE_BODY' instead 'TABLE' or 'PROCEDURE_SPEC' for procedure bodies.


Hope that helps,

clio_usa
OCP - DBA
Reply With Quote
  #4 (permalink)  
Old 01-11-03, 11:44
gfcronin gfcronin is offline
Registered User
 
Join Date: Apr 2002
Posts: 22
I notice that I can't use the USER_SOURCE view to view my View or Trigger code? Can you tell me what data dictionary tables and/or views I need to get at this information?

thanks in advance
Reply With Quote
  #5 (permalink)  
Old 01-11-03, 13:38
billm billm is offline
Drunkard
 
Join Date: Nov 2002
Location: Desk, slightly south of keyboard
Posts: 697
You find the info you want in user_triggers and user_views.

Incidentally for a list of other "user_" type views you can execute

select * from all_objects where object_name like 'USER_%'

HTH
Reply With Quote
  #6 (permalink)  
Old 01-12-03, 13:50
gfcronin gfcronin is offline
Registered User
 
Join Date: Apr 2002
Posts: 22
Excellent!

Thanks for the prompt response Bill!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On