Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> Trigger

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Trigger
 ashish  Posted: Jan 03, 2008 06:10:27 AM

 Total Post: 14
 Joined: Dec, 2007






 i have started learning trigger from complete referece oracle 9i(oracle press).
As the book says i write trigger but when i m trying to run it, it gives TRIGGER CREATED,COMPILATION ERROR.

i tried too much to remove compilation error. plz help me.

 Murtuja
Posted: Jan 03, 2008 06:49:48 AM  

 Total Post: 843
 Joined: Jan, 2006






 
Can you plz post code here ?

 Mohammed Taj
Posted: Jan 03, 2008 07:39:36 AM  

 Total Post: 746
 Joined: Jul, 2007






 
Again run your trigger when you get complation error then put below command on sql prompt and post here output with code.

SQL>SHOW ERROR

 Vish
Posted: Jan 03, 2008 01:05:01 PM  

 Total Post: 47
 Joined: Jan, 2007






 
Make sure that table is there for which you have created Triggers.
Pl. post your code if possible

 ashish
Posted: Jan 04, 2008 12:25:15 AM  

 Total Post: 14
 Joined: Dec, 2007






 
i m putting code here, in witch i m geting trigger created with compilation error...

create or replace trigger secure_emp
before insert on employees
begin
if (To_char(sysdate,'Dy') in ('sat','sun')) or

(To_char(sysdate,'hh24:MI') Not between '08:00' and

'18:00')
Then raise_application_error( - 20500,'you may insert

into employees table only during business hours.');
end if;
end;
/

 Nehru
Posted: Jan 04, 2008 07:55:52 AM  

 Total Post: 45
 Joined: Jul, 2007






 
Hi,

Your Trigger seems to be right.
Better to see that Table Exist or not.
Your Code is:
create or replace trigger secure_emp
before insert on emp
begin
----dbms_output.put_line('Trigger is Working');
if ( UPPER(To_char(sysdate,'Dy')) in ('SAT','SUN')) or (To_char(sysdate,'hh24:MI') Not between '08:00' and '18:00') Then
raise_application_error( - 20500,'you may insert into employees table only during business hours.');
end if;
end;
/
any one try the above one.
Guys let me know if am wrong.

Thanks,
Nehru.


 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar843
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi268
  neeraj sharma252
  Ramesh Jois245
  Bishal Khetan207






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software