若用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.
哪个消息是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}}}}
WhichtwostatementsregardingtheFLASHBACK_TRANSACTION_QUERYviewarecorrect?() A.YoucanfindinformationaboutonlyactivetransactionsfromtheviewB.YoucanfindinformationaboutreadonlytransactionsfromtheviewC.YourequiretheSELECTANYTRANSACTIONsystemprivilegetoaccesstheviewD.YoucanfindinformationaboutbothactiveandcommittedtransactionsfromtheviewE.YourequiretheSELECTONFLASHBACK_TRANSACTION_QUERYobjectprivilegetoaccesstheview
下列语句中,()不是SQL语言的定义事务语句。A.ROLLBACKB.BEGIN TRANSACTIONC.COMMITD.ISOLATION