Hi Team,
My current environment is in 12.1.0.1.
Below is the sample code where I am trying to create an some policies by passing some variable. The issue is it just prints the actual string instead of printing the variable it gets.
For example:
v_machine=prod.example.com
It has to print prod.example.com but it prints the actual string v_machine.. Not sure where I m missing. Please provide your inputs as I m new to Pl/sql.
Audit policy
===========
declare
v_machine varchar2(99);
lv_stmt varchar2(32767);
begin
select host_name into v_machine from v$instance;
lv_stmt := q'[create audit policy LOG_AUDIT ACTIONS LOGON when 'SYS_CONTEXT (''USERENV'', ''HOST'') NOT IN (''v_machine'')' evaluate per session]';
execute immediate lv_stmt;
end;
/
Expected Output:
===========
Audit_policy Action_name Audit _condition
=====================================
LOG_AUDIT LOGON (''USERENV'', ''HOST'') NOT IN (''prod.example.com'')'
Actual Output
==========
Audit_policy Action_name Audit _condition
=====================================
LOG_AUDIT LOGON (''USERENV'', ''HOST'') NOT IN (''V_Machine'')'
Thanks,
Bala