Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > create table DEMO (n int); > > <pre> > ✓ > </pre> <!-- --> > begin transaction; > > <pre> > [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token &quot;transaction&quot; was found following &quot;begin &quot;. Expected tokens may include: &quot;&lt;psm_function_compound_stmt&gt;&quot;. LINE NUMBER=1. SQLSTATE=42601 SQLCODE=-104 > </pre> <!-- --> > insert into DEMO values (0); > > <pre> > ✓ > </pre> <!-- --> > select n "after insert" from demo; > > <pre> > | after insert | > | -----------: | > | 0 | > </pre> <!-- --> > update DEMO set n=1/n; > > <pre> > [IBM][CLI Driver][DB2/LINUXX8664] SQL0801N Division by zero was attempted. SQLSTATE=22012 SQLCODE=-801 > </pre> <!-- --> > select n "after error" from DEMO; > > <pre> > | after error | > | ----------: | > | 0 | > </pre> <!-- --> > commit; > > <pre> > ✓ > </pre> <!-- --> > select n "after commit" from DEMO; > > <pre> > | after commit | > | -----------: | > | 0 | > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=db2_11.1&fiddle=bd665142ae7490069bcbeba42773cb86)*
back to fiddle