Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question, Gyanaranjan.
Asked: August 07, 2016 - 9:58 am UTC
Last updated: August 09, 2016 - 2:46 am UTC
Version: 11g
Viewed 1000+ times
SQL> create table t ( x int ); Table created. SQL> SQL> create or replace 2 trigger trg 3 before insert on t 4 begin 5 if to_char(sysdate,'DY') = 'MON' then 6 raise_application_error(-20000,'Insertion only allowed on Sunday'); 7 end if; 8 end; 9 / Trigger created. SQL> SQL> insert into t values (1); insert into t values (1) * ERROR at line 1: ORA-20000: Insertion only allowed on Sunday ORA-06512: at "MCDONAC.TRG", line 3 ORA-04088: error during execution of trigger 'MCDONAC.TRG'
Gyanaranjan Nayak, August 08, 2016 - 3:53 am UTC
William Robertson, August 08, 2016 - 4:18 pm UTC
if to_char(sysdate,'DY', 'nls_date_language = English') = 'SUN' then ...
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library