# 22. Virtuoso Functions Guide - txn_error

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
mts_connect
mts_get_timeout
mts_set_timeout
mts_status
txn_error
txn_killall
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## txn_error

poison current transaction forcing rollback
txn_error (in code integer);
Description

Calling this function will poison the current transaction. This means that it is forced to roll back at when committed. The code can be in integer that selects the error message generated when trying to commit. This is useful before signalling application errors from SQL code that runs in manual commit mode. This can ensure that even if the client attempts a commit after getting the error signalled by the application the transaction will not commit.

The code should be the constant 6, resulting the in the 'transaction rolled back due to previous SQL Error'.