Oracle SQLplus 上如何查看procedure的内容

    我们知道desc procedure可以看到procedure的declaration。那么如果我们想要在sqlplus上查看procedure的具体内容应该怎么办呢?

    for example:我们要查看scheme cwuk_yy的procedure ABC_GET_CMF

    solution: select text from all_source where name = ‘ABC_GET_CMF' and OWNER='CWUK_YY' order by line;

    我们可以看到screen output:

PROCEDURE abc_get_cmf(

  v_account_no                          NUMBER,

  abc_get_cmf_cv IN OUT cv_types.customer_tp)

IS

BEGIN

  OPEN abc_get_cmf_cv FOR

  SELECT

  no_bill,

  CMF.currency_code,

  prev_bill_date

  FROM CMF

  WHERE CMF.account_no = v_account_no;  

END;

14 rows selected.


    我们可以看下all_source这个表的各个字段
    SQL> desc  all_source;
 Name                                                                    Null?    Type
 ----------------------------------------------------------------------- -------- ------------------------------------------------
 OWNER                                                                            VARCHAR2(30)
 NAME                                                                             VARCHAR2(30)
 TYPE                                                                             VARCHAR2(12)
 LINE                                                                             NUMBER
 TEXT                                                                             VARCHAR2(4000)


SQL> select distinct type from all_source;


TYPE
------------
TYPE BODY
PROCEDURE
LIBRARY
TRIGGER
JAVA SOURCE
PACKAGE
TYPE
FUNCTION
PACKAGE BODY


ALL_SOURCE describes the text source of the stored objects accessible to the current user.
Related Views
  • DBA_SOURCE describes the text source of all stored objects in the database.

  • USER_SOURCE describes the text source of the stored objects owned by the current user. This view does not display the OWNERcolumn.

Column Datatype NULL Description
OWNER VARCHAR2(30) NOT NULL Owner of the object
NAME VARCHAR2(30) NOT NULL Name of the object
TYPE VARCHAR2(12)   Type of object: FUNCTIONJAVA SOURCEPACKAGEPACKAGE BODYPROCEDURETRIGGER,TYPETYPE BODY
LINE NUMBER NOT NULL Line number of this line of source
TEXT VARCHAR2(4000)   Text source of the stored object

useful link:
https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2063.htm#i1588578


你可能感兴趣的:(oracle,procedure)