zoukankan      html  css  js  c++  java
  • 交易系统查询带上for update

    SESSION 1:
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      100
    
    SQL> update testmm set amount=amount * 1.1 where id=1;
    
    1 row updated.
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      110
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      110
        
        
    
    
    
    
    SESSION 2:
    [oracle@yyjk ~]$ sqlplus tlcbuser/tlcbuser
    
    SQL*Plus: Release 11.2.0.4.0 Production on ?..浜.4?.12 09:41:12 2019
    
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      100
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      100
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      100
    
    SQL>  update testmm set amount=amount * 1.1 where id=1;
    
    1 row updated.
    
    SQL> select * from testmm;
    
       ID     AMOUNT
    ---------- ----------
        1      121
        
  • 相关阅读:
    Kafka 探险
    Semaphore 源码分析
    ReentrantLock 与 AQS 源码分析
    synchronized 原理分析
    ConcurrentHashMap 源码分析
    LinkedHashMap 源码分析
    HashMap 源码分析
    ArrayList 源码分析
    TCP 详解
    proxifier配合ss,实现全局代理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348799.html
Copyright © 2011-2022 走看看