Purpose
This view displays the text source of stored objects owned by the current user. It has the same columns as ALL_SOURCE, but without the OWNER column.
Applicability
This view is available only in OceanBase Database in Oracle mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| 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 it is a system package, the value is 0. |
Sample query
Query the text source of stored objects owned by the current user and display the first two records.
obclient [SYS]> SELECT * FROM SYS.USER_SOURCE WHERE ROWNUM<=2\G
The query result is as follows:
*************************** 1. row ***************************
NAME: DEPT_CTX_PKG
TYPE: PACKAGE BODY
LINE: 1
TEXT: PACKAGE BODY dept_ctx_pkg IS
PROCEDURE set_dept(dept_val VARCHAR2) IS
BEGIN
DBMS_SESSION.SET_CONTEXT('dept_ctx', 'CURRENT_DEPT', dept_val); -- The namespace and context name must be consistent<sup>1</sup>
END;
END;
ORIGIN_CON_ID: 1004
*************************** 2. row ***************************
NAME: DEPT_CTX_PKG
TYPE: PACKAGE
LINE: 1
TEXT: PACKAGE dept_ctx_pkg IS
PROCEDURE set_dept(dept_val VARCHAR2);
END;
ORIGIN_CON_ID: 1004
2 rows in set
References
Query the text source of all stored objects in the current tenant: DBA_SOURCE
Query the text source of all stored objects accessible to the current user: ALL_SOURCE