Note
This view is available starting with V2.2.30.
Purpose
This view displays the text sources of stored objects owned by the current user. The columns of this view are the same as those of ALL_SOURCE, except that the OWNER column is removed.
Applicability
This view is applicable only to 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 the object is a system package, the value is 0. |
Sample query
Query the text sources 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 sources of all stored objects in the current tenant: DBA_SOURCE
Query the text sources of all stored objects accessible to the current user: ALL_SOURCE