Note
This variable was introduced in OceanBase Database V4.0.0 CE.
Description
The plsql_ccflags variable controls conditional compilation.
Applicability
This variable applies only to OceanBase Database in Oracle mode.
Privilege requirements
Query a variable
Global level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or viewSYS.TENANT_VIRTUAL_GLOBAL_VARIABLE(Oracle mode) andinformation_schema.GLOBAL_VARIABLES(MySQL mode) to query the value of a global system variable.Session level
The
systenant and all user tenants can execute theSHOW VARIABLESstatement or viewSYS.TENANT_VIRTUAL_SESSION_VARIABLE(Oracle mode) andinformation_schema.SESSION_VARIABLES(MySQL mode) to query the value of a session system variable.
Modify a variable
Global level
The
systenant can directly modify the value of a global system variable.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.For V4.x, Oracle user tenants must have the
ALTER SYSTEMprivilege to modify the value of a global system variable starting from V4.2.0.
Session level
The
systenant and all user tenants can directly modify the value of a session system variable in the current tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | varchar |
| Default value | N/A |
| Value range | A string that conforms to the PL Compiler specification |
| Scope |
|
| Modifiable | Yes. You can modify this variable by using the SET statement. |
Considerations
The format of the plsql_ccflags variable is plsql_ccflags= '<v1>:<c1>,<v2>:<c2>,...,<vn>:<cn>', where
- vi is a PL/SQL identifier that is case-insensitive and can be a reserved keyword.
- ci is the value of vi, which can be a Boolean, pls_integer, or NULL value. The value is case-insensitive.
Examples
The following examples set the conditional compilation identifiers and their corresponding values as follows: v_t corresponds to true, v_f corresponds to false, and v_1 corresponds 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; /