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: Database Administration >> before insert 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: before insert trigger
 chinna  Posted: Jun 25, 2007 03:00:51 AM

 Total Post: 28
 Joined: May, 2007






 hi friends,
i want to insert a record into dept table and
am suppose to write a trigger(before insert) on dept table.
The trigger body should hold the required conditions,
if :new.deptno is already existing in the dept table then
insertion should be aborted unconditionally and no message should be displayed,else the new record should be inserted into dept table.
i request your help on writing this trigger.


thanks,
srawan




 fireit
Posted: Jun 26, 2007 12:22:09 PM  

 Total Post: 23
 Joined: Apr, 2007






 
you can put a Unique constraint in your table (it is the best way). when you will try to insert, it will raise an error that you can catch to display a message.
if you don't want this, you have to go through your table and make comparison till :system.last_record='TRUE'

 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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






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