Solved

Pre-update trigger in oracle forms

Posted on 2004-04-26
2
3,018 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
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

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.

Question has a verified solution.

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

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

932 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

14 Experts available now in Live!

Get 1:1 Help Now