Solved

Pre-update trigger in oracle forms

Posted on 2004-04-26
2
2,989 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
2 Comments
 
LVL 1

Expert Comment

by:Xavi23
Comment Utility
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
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now