Solved

Pre-update trigger in oracle forms

Posted on 2004-04-26
2
3,088 Views
Last Modified: 2007-12-19
hi,

In a form i have:

ID      Name
1       Tom
2       Mark
3       Dennis
....     ....

And i have such a situation that someone is updating item "Mark" with id=2 to another name. The new name he writes is "Tom". But the column name must be unique in that table. So i need to write trigger (pre-update i think) that would return back a value "Mark" to a field with ID=2 when user updating that field enters name "Tom" and presses save or cursor leaves the item.
How could i do so?
Thanks
0
Comment
Question by:sky_lt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Expert Comment

by:Xavi23
ID: 10916585
You can create a unique key in colum 'name'

for example

ALTER TABLE TABLE_NAME
 ADD CONSTRAINT CONSTRAINT_NAME
 UNIQUE (Name)
 ENABLE
 VALIDATE
0
 
LVL 22

Accepted Solution

by:
Helena Marková earned 50 total points
ID: 10916606
I think that you can use DATABASE_VALUE property in a Pre-Update trigger. This trigger fires for each record.

IF Get_Item_Property('your_block.your_item',DATABASE_VALUE)<>:your_block.your_item THEN
  :your_block.your_item :=Get_Item_Property('your_block.your_item',DATABASE_VALUE);
END IF;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question