开发者

check if oracle function exists

开发者 https://www.devze.com 2023-04-03 12:59 出处:网络
I have an Oracle schema, where I have some functions and some packages that have functions inside. How can I test if a string value is a function name in my schema, and if it is, return the function

I have an Oracle schema, where I have some functions and some packages that have functions inside.

How can I test if a string value is a function name in my schema, and if it is, return the function result, or if it's not a function to return the string value?

I tried to start from

SELECT * FROM ALL_OBJECTS 
WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE','PACKAGE_BODY')

but this does not return the function names from inside the packages. Th开发者_如何学Goank you!


Use the view ALL_PROCEDURES.

The column OBJECT_NAME will show you the name of standalone functions and procedures, and packages names. The column PROCEDURE_NAME will show you the names of functions and procedures inside a package.

As you're only interested in functions you might be better off using ALL_ARGUMENTS. This views records the parameters used by a procedure or function. If a given program unit has a POSITION with a value of zero, that indicates the return value for a function.

0

精彩评论

暂无评论...
验证码 换一张
取 消