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>
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>