若用SQL语句编写的转账业务事务程序如下:START TRANSACTION;SET TRANSACTION ISOLATION LEVEL SERIALIZABLEUPDATE AccountsSET CurrentBalance=CurrentBalance-AmountWHERE AccountID=A;if error then ROLLBACK;COMMIT;UPDATE AccountsSET CurrentBalance=CurrentBalance+AmountWHERE AccountID=B;if error then ROLLBACK;COMMIT;其中:Accounts为账户表,CurrentBalance为当前余额,Amount为新存入的金额。该事务程序能否保证数据的一致性?如不能,请说明原因并改正。(100字以内)

若用SQL语句编写的转账业务事务程序如下:

START TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

UPDATE Accounts

SET CurrentBalance=CurrentBalance-Amount

WHERE AccountID=A;

if error then ROLLBACK;

COMMIT;

UPDATE Accounts

SET CurrentBalance=CurrentBalance+Amount

WHERE AccountID=B;

if error then ROLLBACK;

COMMIT;

其中:Accounts为账户表,CurrentBalance为当前余额,Amount为新存入的金额。

该事务程序能否保证数据的一致性?如不能,请说明原因并改正。(100字以内)


相关考题:

Youexecutedthefollowingquery:SELECToperation,undo_sql,table_nameFROMflashback_transaction_queryWhichstatementiscorrectregardingthequeryoutput?() A.Itwouldreturninformationregardingonlythelastcommittedtransaction.B.Itwouldreturnonlytheactivetransactionsinalltheundosegmentsinthedatabase.C.Itwouldreturnonlythecommittedtransactionsinalltheundosegmentsinthedatabase.D.Itwouldreturnbothactiveandcommittedtransactionsinalltheundosegmentsinthedatabase.E.Itwouldreturninformationregardingthetransactionsthatbeganandwerecommittedinthelast30minutes.

Youexecutedthefollowingquery:SELECToperation,undo_sql,table_nameFROMflashback_transaction_query;Whichstatementiscorrectregardingthequeryoutput?() A.Itwouldreturninformationregardingonlythelastcommittedtransaction.B.Itwouldreturnonlytheactivetransactionsinalltheundosegmentsinthedatabase.C.Itwouldreturnonlythecommittedtransactionsinalltheundosegmentsinthedatabase.D.Itwouldreturnbothactiveandcommittedtransactionsinalltheundosegmentsinthedatabase.E.Itwouldreturninformationregardingthetransactionsthatbeganandwerecommittedinthelast30minutes.

事务(transaction)的ACID四个性质是指事物具有 ______________、一致性,________________和持久性。

哪个消息是MGC发给MG的心跳消息?() A、!/1[192.168.6.71]:2944Transaction=20{Context=-{AuditValue=ROOT{Audit{}}}}B、!/1[192.168.6.71]:2944Transaction=5{Context=-{Auditcapability=A0{Audit{Media,packages}}}}C、!/1[191.2.6.213]:2944Transaction=275{Context=-{Notify=ROOT{ObservedEvents=0{19700101T01153516:it/ito}}}}D、!/1[192.168.1.119]:2944Transaction=2050{Context=-{AuditValue=ROOT{Audit{Package s}}}}

事务(Transaction)是一个______。A.程序B.进程C.操作序列D.完整性规则

WhichtwostatementsregardingtheFLASHBACK_TRANSACTION_QUERYviewarecorrect?() A.YoucanfindinformationaboutonlyactivetransactionsfromtheviewB.YoucanfindinformationaboutreadonlytransactionsfromtheviewC.YourequiretheSELECTANYTRANSACTIONsystemprivilegetoaccesstheviewD.YoucanfindinformationaboutbothactiveandcommittedtransactionsfromtheviewE.YourequiretheSELECTONFLASHBACK_TRANSACTION_QUERYobjectprivilegetoaccesstheview

Transaction接口主要用于管理事务。它的哪个方法用于事务的提交() A.wasRollBack方法B.rollback方法C.commit方法D.wasCommitted方法

回滚事务,可以使数据恢复到事务开始时的状态,使用()transaction 语句

下列语句中,()不是SQL语言的定义事务语句。A.ROLLBACKB.BEGIN TRANSACTIONC.COMMITD.ISOLATION