We have a situation where we need to allow particular users which are stored in a table.
create table ALLOW_USERS (username varchar2(30) );
CREATE OR REPLACE TRIGGER USERS_TRIGGER
AFTER LOGON
ON DATABASE
DECLARE
BEGIN
IF DBMS_STANDARD.LOGIN_USER NOT IN (SELECT USERNAME FROM ALLOW_USERS)
THEN
RAISE_APPLICATION_ERROR (-20001, 'Unauthorized login');
END IF;
END;
/
Warning: Trigger created with compilation errors.
SQL> show error
Errors for TRIGGER USERS_TRIGGER:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/3 PL/SQL: Statement ignored
3/38 PLS-00405: subquery not allowed in this context
How to use subquery on the above trigger ? or is there any better way to achive required results .
-Thanks