Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is :old and :new just a database trigger?

Status
Not open for further replies.

PatrickB101

Programmer
Oct 4, 2001
22
US
is :eek:ld and :new just a database trigger?
 
In what context? Within a trigger :eek:ld and :new are used to refer to the value a column has before it was changed and :new the value it has after it changed.

Does this answer your question? SOL
The best thing about banging your head against a wall is when you stop.
 
i am trying to build a botton on my form with oracle developer that does this

if :eek:ld.colname <> :new.colname then
:storecolname := :eek:ld.colname
end if;
but all the examples I have seen where this work are database triggers not a &quot;when button pressed trigger&quot; so i was wondering if new and old can only be accessed by a database trigger
 

Not really, because it depends on the created trigger if you assign the new values as NEW and old values as OLD. Inside the trigger you will reference your data as :OLD and :NEW.

I understand that most of the documents uses such reference for ease of understanding. But if you want to confuse yourself you can use other references for old and new values. For example;

CREATE TRIGGER mytrigger
AFTER UPDATE ON mytable
REFERENCING OLD AS oldies NEW AS newbies
FOR EACH ROW
WHEN (newbies.column='999999')
BEGIN
INSERT INTO table2
....
VALUES :)oldies.column1, :eek:ldies.column2 ....);
END;
/

For the Oracle Developer part, lets wait for other inputs.


 
If you want to get the old and new values after you update, why not something like this:
1. select the record first and store to a variable say, &quot;old&quot;
2. your update statement
3. select again or assign the current value, then store it to another variable, say &quot;new&quot;
4. use your statement referencing these variables.

Actually you can also use the :eek:ld and :new of the database trigger but you have to create a package body and then assign to it your :eek:ld and :new values and use this package body to get the value from Forms.

Does it help?
 
Oracle Developer's triggers have about nothing to kind of database triggers. The only similar property is that they are normally not called directly but rather &quot;triggered&quot; by some event. So do not mix up them. In Form's trigger :eek:ld and :new (if this trigger does work :) ) are probably block names used to fully qualify item within form.
 
my meaning of creating package body is a database package body and not inside Forms. But its quite not a friendly approach to your program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top