According to https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CREATE-ROLE.html the IF NOT EXISTS
clause is not supported.
However, it seems to work partially (I guess the IF NOT EXISTS
is tolerated but ignored) as the following example shows.
Connected to:
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
SQL> select role from dba_roles where role = 'XYZ';
no rows selected
SQL> create role if not exists xyz;
Role created.
SQL> select role from dba_roles where role = 'XYZ';
ROLE
--------------------------------------------------------------------------------
XYZ
SQL> create role if not exists xyz;
create role if not exists xyz
*
ERROR at line 1:
ORA-01921: role name 'XYZ' conflicts with another user or role name
SQL>
Question: Is it planned to support IF NOT EXISTS
when releasing SE/EE of 23c? If not, I suggest throwing an error when trying to use the IF NOT EXISTS
clause for unsupported statements.