commited work in a store procedure
Posted in 1995
This is a pass through question from another programmer about SPL, please forgive any strange or ignorant questions/wording for I am a 4GL programmer, have not worked much with SPL. We have a stored procedure that reads a transaction table and then updates/inserts the information into a master table. We are having a problem when we have consective rows that insert/update the same row. Here is the sumary of the procedure: 1. Read a new row form the transaction table 2. Selects from the master table 3. Compares the lookup keys in the transaction to the master row 4. If the same assumes update in the master table 5. If not the same assumes insert in the master table Told SPL does not have a sqlca.sqlcode record :^( Well, if the procedure reads a transaction row that does not exists it, inserts OK, but if the next row read has the same lookup keys, the procedure believes the select on the master table has failed and inserts the row again. This happens about 2 or 3 times in a row, but on the next row it will find all the records selected and dies, cuz multiple records are returned by the select statement. It looks like some sort of delayed commit work or something(just a guess), what rules does SPL follow for begin/commit work? Does the execution of a store procedure setup a begin/commit work around the procedure, or is begin/commit work based implicity on the statements inside the procedure? Is the isolation mode inherited from the executing program? or can it be set in the procedure? We have a work around for the problem, use a unique index, but that is not the prefered solution, we would like to figure out what we are doing wrong. All help will be duly appreciated. ===================================================================== Paul Watje Database Something or Another watjep@hasting.com Hastings Books, Music, & Video