Try adding variable indicators ? INTO pvOppActID vi1, pvOppID vi2 Bill Eyring
_____ From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Monday, July 30, 2012 9:56 AM To: RBASE-L Mailing List Subject: [RBASE-L] - Struggling with SP code Working with 9.5. I have a table called OppActivity, with a PK autonumber field OppActivityID. There is a FK field OppID that points to the master table Opportunity that has a PK OppID. What I need to do: I know it breaks every relational rule but for performance purpose we want to update 4 fields in Opportunity to show the latest values from OppActivity. I have a SP/Trigger working perfectly when I insert and delete a row into OppActivity to get the latest row and put in Opportunity. My problem is with the Delete SP. Doesn't seem to work the same way as 7.6 did... I want the trigger to work both from a form but also from a data browser at the r> prompt so I don't want to rely on there being pre-defined variables to indicate which OppID I'm working on. Here's the code I'm using (edited down to show only 1 of the 4 fields I want to update), but I'm getting all kinds of "resource conflict" and other errors, strangely on the "select (max)" line. I'm working locally, multi off. I have this as a "before delete" trigger. Any suggestions? SET VAR pvOppID INT = NULL, pvOppActID INT = NULL, pvADate DATE = NULL SELECT OppActivityID, OppID INTO pvOppActID, pvOppID FROM OppActivity WHERE CURRENT OF SYS_OLD SELECT (MAX(OppActivityID)) INTO pvOppActivityID FROM OppActivity + WHERE OppID = .pvOppID AND OppActivityID <> .pvOppActID SELECT ActivityDate INTO pvADate + FROM OppActivity WHERE OppActivityID = .pvOppActivityID UPDATE opportunity SET + CurrActivityDate = .pvADate + WHERE OppID = .pvOppID Thanks for looking! Karen

