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 |
Send this thread to your friend |
|
|
|
|
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 Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 333 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|