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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Trigger ?

Status
Not open for further replies.

ikh

Programmer
Apr 17, 2001
24
0
0
CA
I need to write a simple update trigger which should do following: update a logical field with .T. if any other fields changed. I wrote few lines of code that I thought should do it, but I am failing with "Cannot update cursor" error. Can somebody help???
 
Hello,

It's not that difficult but try this simple thing.
I guess you are using
- more than one table
- sql cursor table

Therefore, somewhere it gets lost before you try to update. maybe it is pointing to the cursor.

select the <table name> before you update the required table.

Thanks
 
Is the field you are updating in the same table? You cannot do that via a trigger then. Think about it: the trigger fires, and then changes a value in the same table, which fires the trigger, which changes a value in the same table, which fires the trigger, ... in other words, and infinite loop. You can update a separate table in a trigger, but not the table on which the trigger is firing.

== Ed Leafe
 
Can't I use optimistic buffering and compare curval() with oldval() for all fields except this logical one ???
 
Nope! Triggers are meant for validating data, maintaining referential integrity (between tables) and &quot;auditing&quot; to another file - not for fixing fields in the same table.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top