Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 516
  • Last Modified:

Oracle - Get detail of a UDF

I'm needing to see the contents of a particular user defined function in Oracle.

How do I get the detail?  I'm using Toad.
0
patriotpacer
Asked:
patriotpacer
  • 9
  • 7
1 Solution
 
slightwv (䄆 Netminder) Commented:
Try this:
select dbms_metadata.get_ddl('FUNCTION','THE_UDF_NAME') from dual;


Using Toad, you should be able to browse to the object to see the code but I'm not a Toad user so I don't know for sure.
0
 
patriotpacerAuthor Commented:
>>Using Toad, you should be able to browse to the object to see the code but I'm not a Toad user so I don't know for sure.

I'm more sql server, so don't know my way around Toad very well.

Thx...let me try your tip.
0
 
patriotpacerAuthor Commented:
Any tips on getting past this error?



ORA-31603: object "F_Count_Attempts" of type FUNCTION not found in schema "<<my username>>"
ORA-06512: at "SYS.DBMS_METADATA", line 5088
ORA-06512: at "SYS.DBMS_METADATA", line 7589
ORA-06512: at line 1
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
slightwv (䄆 Netminder) Commented:
Did you add the double quotes?

Oracle converts object names to upper case.  You can force case sensitivity by using double quotes but it is not advised.

If you used mixed-case with single quotes, make it all upper case inside the single quotes.

Can you post the exact select you ran?
0
 
patriotpacerAuthor Commented:
select dbms_metadata.get_ddl ('FUNCTION','F_Count_Attempts') from dual;
0
 
slightwv (䄆 Netminder) Commented:
Make it upper case:

select dbms_metadata.get_ddl ('FUNCTION','F_COUNT_ATTEMPTS') from dual;
0
 
patriotpacerAuthor Commented:
Still same error.  

Here's how it's used:
...Pkg_Scheduler.F_Count_Attempts(i.ID)...

Open in new window

0
 
patriotpacerAuthor Commented:
Is it possible that I just can't see it?  Can call it but can't view contents?
0
 
slightwv (䄆 Netminder) Commented:
It doesn't matter how it's called.  Oracle still converts it to upper case.

This way all these work (assuming you have a table named bob)
select * from BOB;
select * from BoB;
select * from bob;



>>Pkg_Scheduler.F_Count_Attempts

OK, this is part of a package.  This is different.

select dbms_metadata.get_ddl ('PACKAGE_BODY','PKG_SCHEDULER') from dual;
0
 
patriotpacerAuthor Commented:
Here's what I get...

ORA-31603: object "PKG_SCHEDULER" of type PACKAGE_BODY not found in schema "<<my username>>"
ORA-06512: at "SYS.DBMS_METADATA", line 5088
ORA-06512: at "SYS.DBMS_METADATA", line 7589
ORA-06512: at line 1
0
 
slightwv (䄆 Netminder) Commented:
You may not have permission to see the source.

You can add the owner to the call:
select dbms_metadata.get_ddl ('PACKAGE_BODY','PKG_SCHEDULER','SCOTT') from dual;

Where SCOTT is the owning user.
0
 
patriotpacerAuthor Commented:
Cool.  

Last question...

Is there a way to find the owner?
0
 
patriotpacerAuthor Commented:
thanks for all the help.
0
 
slightwv (䄆 Netminder) Commented:
>>Is there a way to find the owner?

Try this:
select owner from all_objects where object_name='PKG_SCHEDULER';
0
 
patriotpacerAuthor Commented:
>>select owner from all_objects where object_name='PKG_SCHEDULER';

Thanks, slightwv!
0
 
slightwv (䄆 Netminder) Commented:
No problem.

Welcome to Oracle!

Once you get over the culture shock and learn your way around, you'll never want to go back to SQL Server!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now