Note
This variable is available starting with V4.0.0_CE.
Description
The plsql_ccflags variable is used to control conditional compilation.
Applicability
This variable applies only to OceanBase Database in Oracle-compatible mode.
Privilege requirements
Query variables
Global level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle-compatible mode) or theinformation_schema.GLOBAL_VARIABLESview (MySQL-compatible mode) to obtain the values of global system variables.Session level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle-compatible mode) or theinformation_schema.SESSION_VARIABLESview (MySQL-compatible mode) to obtain the values of session system variables.
Modify variables
Global level
The
systenant can modify the value of a global system variable.A MySQL user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.An Oracle user tenant must have the
ALTER SYSTEMprivilege to modify the value of a global system variable.
Session level
The
systenant and all user tenants can modify the value of a session system variable.
Attributes
Attribute |
Description |
|---|---|
| Type | varchar |
| Value range | A string that conforms to the PL Compiler specification. |
| Scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Usage
The syntax for configuring plsql_ccflags is plsql_ccflags= '<v1>:<c1>,<v2>:<c2>,...,<vn>:<cn>' where
- vi is a PL/SQL identifier, which is case-insensitive. It can be a reserved keyword.
- ci is the value corresponding to vi. It can be a Boolean, pls_integer, or NULL value, which is case-insensitive.
Examples
Set the plsql_ccflags variable to specify the conditional compilation identifiers and their corresponding values. For example, set the value of v_t to true, the value of v_f to false, and the value of v_1 to 6. If v_f is not null, the DBMS_OUTPUT.PUT_LINE statement is executed to output information.
Session level
obclient> ALTER SESSION SET plsql_ccflags = 'v_t:true,v_f:false,v_1:6'; create or replace function my_func return number is begin $if $$v_f is not null $then DBMS_OUTPUT.PUT_LINE('$$PLSQL_UNIT = ' || $$PLSQL_UNIT); DBMS_OUTPUT.PUT_LINE('$$PLSQL_UNIT_OWNER = ' || $$PLSQL_UNIT_OWNER); $end return 200; end; /Global level
obclient> SET GLOBAL plsql_ccflags = 'v_t:true,v_f:false,v_1:6'; create or replace function my_func return number is begin $if $$v_f is not null $then DBMS_OUTPUT.PUT_LINE('$$PLSQL_UNIT = ' || $$PLSQL_UNIT); DBMS_OUTPUT.PUT_LINE('$$PLSQL_UNIT_OWNER = ' || $$PLSQL_UNIT_OWNER); $end return 200; end; /
