Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pre-update trigger in oracle forms

Posted on 2004-04-26
2
Medium Priority
?
3,285 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 200 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

Industry Leaders: 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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

885 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