Re: SQL question "Transactions"
Posted in 1999
>BEGIN WORK
>LOCK TABLE stock;
>#^
># 201: A syntax error has occurred.
>#
>UPDATE stock SET unit_price = unit_price * 1.10
> WHERE manu_code ='KAR'
>DELETE FROM stock WHERE description ='baseball_bat'
>INSERT INTO manufact (manu_code, manu_name, lead_time)
> VALUES ('LYM','LYMAN, 14)>COMMIT WORK
>
1. In dbaccess, 'BEGIN WORK' should be terminated with ';'
2. Indicate locking mode in lock table statement
3. UPDATE, DELETE, and INSERT should all be terminated with ';'
4. Second term in values of insert is not correctly quoted
This is of course assuming that you are connected to a logged database, that
you really want to lock the table or that this isn't a 'real' database, and
that you insist on including the commit work statement in your script. That
last one kind of defeats the purpose of the transaction regarding the ability
to rollback. As far as the presence of a ';' creating a problem for dbaccess,
only if it is where it shouldn't be, or only if one is missing previously.