简体   繁体   English

如何提取在函数/过程中使用的所有Oracle关键字

[英]How to extract all Oracle Keywords used In a Function/Procedure

Is there any easy way to fetch all the Oracle key words used In a function/procedure? 是否有任何简单的方法来提取函数/过程中使用的所有Oracle关键字?

The first thing that strikes me Is to split the text from user_source for the given object name based on space but this will leave few scenarios uncovered like DBMS_OUTPUT.PUT_LINE('HELLO WORLD') etc., 让我大吃一惊的是,基于空间将给定对象名称的文本从user_source拆分出来,但这会发现一些未发现的情况,例如DBMS_OUTPUT.PUT_LINE('HELLO WORLD')等,

Is there any other way rather than split by space, dot, paranthesis? 除了通过空格,点,偏括号拆分之外,还有其他方法吗?

Regards, KG KG

You could use built-in ALL_STATEMENTS / ALL_IDENTIFIERS . 您可以使用内置的ALL_STATEMENTS / ALL_IDENTIFIERS

ALL_STATEMENTS describes all SQL statements in stored PL/SQL objects accessible to the user. ALL_STATEMENTS描述了用户可访问的已存储PL / SQL对象中的所有SQL语句。

And The Power of Cloud PL/SQL : 云PL / SQL的强大功能

To gather information about PL/SQL identifiers and SQL statements in your code base, execute the following statement in your session 要在代码库中收集有关PL / SQL标识符和SQL语句的信息,请在会话中执行以下语句

ALTER SESSION SET plscope_settings='identifiers:all, statements:all';
-- function/package compilation

SELECT st.owner,
       st.object_name,
       st.line,
       s.text
  FROM all_statements st join all_source s
    ON ( st.owner = s.owner
   AND st.object_name = s.name
   AND st.line = s.line )
 WHERE st.TYPE IN ('EXECUTE IMMEDIATE', 'OPEN')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM