隐式游标的属性值变化

SQL> begin
  2    dbms_output.put_line('DML操作之前');
  3    if sql%rowcount is null then
  4       dbms_output.put_line('sql%rowcount is null');
  5    end if;
  6    if sql%isopen is null then
  7       dbms_output.put_line('sql%isopen is null');
  8    elsif sql%isopen=false then
  9       dbms_output.put_line('sql%isopen is fasle');
 10    else
 11       dbms_output.put_line('sql%isopen is true');
 12    end if;
 13    if sql%found is null then
 14       dbms_output.put_line('sql%found is null');
 15    end if;
 16    if sql%notfound is null then
 17       dbms_output.put_line('sql%notfound is null');
 18    end if;
 19  end;
 20  /
DML操作之前
sql%rowcount is null
sql%isopen is fasle
sql%found is null
sql%notfound is null
PL/SQL procedure successfully completed


SQL> Begin
 23    dbms_output.put_line('*******DML操作之后********');
 24    Update dept Set dname=Upper(dname);
 25    If Sql%Rowcount Is Null Then
 26       dbms_output.put_line('SQL%ROWCOUNT为空');
 27    Else
 28       dbms_output.put_line(SQL%ROWCOUNT);
 29    End If;
 30    If Sql%Isopen Then
 31       dbms_output.put_line('SQL%ISOPEN为True');
 32    Else
 33       dbms_output.put_line('SQL%ISOPEN为False');
 34    End If;
 35    If Sql%Found Then
 36       dbms_output.put_line('SQL%Found为True');
 37    Else
 38       dbms_output.put_line('SQL%Found为False');
 39    End If;
 40    If Sql%Notfound Then
 41       dbms_output.put_line('SQL%NotFound为True');
 42    Else
 43       dbms_output.put_line('SQL%NotFound为False');
 44    End If;
 45    dbms_output.put_line('*******ROLLBACK后**********');
 46    Rollback;
 47    If Sql%Rowcount Is Null Then
 48       dbms_output.put_line('SQL%ROWCOUNT为空');
 49    Else
 50       dbms_output.put_line(SQL%ROWCOUNT);
 51    End If;
 52    If Sql%Isopen Then
 53       dbms_output.put_line('SQL%ISOPEN为True');
 54    Else
 55       dbms_output.put_line('SQL%ISOPEN为False');
 56    End If;
 57    If Sql%Found Then
 58       dbms_output.put_line('SQL%Found为True');
 59    Else
 60       dbms_output.put_line('SQL%Found为False');
 61    End If;
 62    If Sql%Notfound Then
 63       dbms_output.put_line('SQL%NotFound为True');
 64    Else
 65       dbms_output.put_line('SQL%NotFound为False');
 66    End If;
 67  End;
 68  /
*******DML操作之后********
4
SQL%ISOPEN为False
SQL%Found为True
SQL%NotFound为False
*******ROLLBACK后**********
0
SQL%ISOPEN为False
SQL%Found为False
SQL%NotFound为True
PL/SQL procedure successfully completed


SQL> 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值