Global Variable values for Triggers [message #253847] |
Wed, 25 July 2007 01:56  |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
hi all gurus!
using database: Oracle9i Enterprise Edition Release 9.2.0.8.0
Developer: 6i and 10g Release 1
i have a table:
create table order_track (
buyer_id varchar2(5),
seller_id varchar2(5),
item_id varchar2(10),
item_qty number(8),
item_rate number(10,2),
initiated_on date,
delivered_on date
)
the table has a trigger which is Before Insert, and its inserting data in another table.
i have made a user interface (FORM) and i am assining an ID to the user which is :GLOBAL.user_id, how i can catch this variable's value in the said Trigger so i can insert in another table.
NOTE: i searched for GLOBAL variables but failed to find something for this scenario.
thanks in advance.
|
|
|
|
|
|
Re: Global Variable values for Triggers [message #253855 is a reply to message #253847] |
Wed, 25 July 2007 02:15   |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
how it will be passed to the Trigger as trigger normally catches the values of the concerned table values with OLD and NEW or whatever you specify and the values for the variables we defined in the Trigger's declare section.
|
|
|
|
|
Re: Global Variable values for Triggers [message #253859 is a reply to message #253847] |
Wed, 25 July 2007 02:23   |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
azamkhan wrote:
Quote: | What I have understood is that you want to refer the value of a Global variable... plz clearify your problem
|
yes, absolutely, but to pass the value we have to pass the Global variable to the Trigger like we are passing to Functions/Procedures the variables with some values....
to Littlefoot:
its my Generated ID in Form...
[Updated on: Wed, 25 July 2007 02:26] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Global Variable values for Triggers [message #253868 is a reply to message #253847] |
Wed, 25 July 2007 02:48   |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
- when user first entering into main interface and if he is using above said form to make new entry.
- the global variable contains logged in date, time, ip and user_id from which he logged in.
the main problem is the logged in date and time as these values can be changed at the time of data entry.
|
|
|
|
Re: Global Variable values for Triggers [message #255167 is a reply to message #253888] |
Mon, 30 July 2007 22:58  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
I don't know whether you want to populate the 'buyer_id' or the 'seller_id' so I will assume the 'buyer_id'.
When the user signs on to the system I assume that you are populating ':GLOBAL.user_id'.
I suggest that you populate 'buyer_id' either in the When-Create-Record or Pre-Insert trigger in the form and then in the pre-insert trigger in the database use the ':new.buyer_id' as part of insert statement to the other table.
David
|
|
|