Note
This view is available starting with V2.2.30.
Purpose
This view displays the text sources of the stored objects accessible to the current user.
Applicability
This view applies only to OceanBase Database in Oracle-compatible mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| OWNER | VARCHAR2(30) | NO | The owner of the object. |
| NAME | VARCHAR2(30) | NO | The name of the object. |
| TYPE | VARCHAR2(12) | NO | The type of the object. |
| LINE | NUMBER | NO | The line number in the source code corresponding to the TEXT field. |
| TEXT | CLOB | NO | The source code of the current line. |
| ORIGIN_CON_ID | NUMBER(38) | NO | The tenant ID of the tenant to which the object belongs. If the object is a system package, the value is 0. |
Sample query
Query the text sources of the stored objects accessible to the current user and display the first two records.
obclient [SYS]> SELECT * FROM SYS.ALL_SOURCE WHERE ROWNUM<=2\G
The query result is as follows:
*************************** 1. row ***************************
OWNER: SYS
NAME: JOB_UTILS
TYPE: PACKAGE
LINE: 1
TEXT: PACKAGE JOB_UTILS IS
PROCEDURE insert_date;
PROCEDURE insert_date_program ( job IN VARCHAR2, job_name IN VARCHAR2);
END;
ORIGIN_CON_ID: 1004
*************************** 2. row ***************************
OWNER: SYS
NAME: JOB_UTILS
TYPE: PACKAGE BODY
LINE: 1
TEXT: PACKAGE BODY JOB_UTILS IS
PROCEDURE insert_date IS
BEGIN
INSERT INTO DBMS_SCHEDULER_T1 VALUES(TO_CHAR(sysdate));
COMMIT;
END;
PROCEDURE insert_date_program ( job IN VARCHAR2, job_name IN VARCHAR2) IS
BEGIN
INSERT INTO DBMS_SCHEDULER_T2 VALUES(sysdate, job, job_name);
COMMIT;
END;
END;
ORIGIN_CON_ID: 1004
2 rows in set
References
Query the text sources of all stored objects in the current tenant: DBA_SOURCE
Query the text sources of stored objects owned by the current user: USER_SOURCE