Transaction suspending from UDR
Posted in 2001
Topics: Jobs, Consulting & Announcements
Is there any way to suspend/resume a transaction from UDR? Thanks. Artem Goncharuk
Artem Goncharuk wrote: > Is there any way to suspend/resume a transaction from UDR? If you mean that you want to do some operations which are not part of the current transaction, then there isn't any way that I know of to do it. It's a problem, too; how do you record an error in a log table if the rollback of the TX will remove the record from the log table? -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"
In article <946vka$2fbl$1@nl.novosoft.ru>, "Artem Goncharuk" <art@land3.nsu.ru> wrote: > Is there any way to suspend/resume a transaction from UDR? It's really important to distinguish between two types of User-Defined Routines (UDR). There are stored procedures, and there are user-defined functions (UDFs). Stored procedures are the good-old stored procedures all DBMS developers are familiar with. And within a stored procedure, you can -- subject to certain rules like no nested transactions -- start and stop a transaction. User-Defined Functions -- which unlike stored procedures rarely contain any SQL but are rather more like sub-routines or methods in a procedural or object-oriented language -- behave somewhat differently. When it encounters an exception, code in a UDF can raise an error, and in doing so it can abort an in-flight transaction. (Remember: UDFs are invoked as part of a SQL query, so when the query throws an exception the DBMS rolls back any and all currently "in-flight" transactional operations). But code in the UDF cannot, by itself, begin/end/rollback an entire transaction. This difference between UDFs and stored procedures affects the way you do analysis and design with OR-DBMS products. UDFs, as I've said, are like sub-routines: small modules often invoked many times in a single query. Stored procedures, on the other hand, reflect business processes that have looping/branching constructs. Anyway, trying to do a stop/start transaction inside a function being called by a query is a big like driving a car everywhere in reverse. Sure, it gets you there, eventually. But there's another way of doing it that's much easier. Hope this helps. KR Pb Sent via Deja.com http://www.deja.com/