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