Chinaunix首页 | 论坛 | 博客
  • 博客访问: 775456
  • 博文数量: 180
  • 博客积分: 4447
  • 博客等级: 上校
  • 技术积分: 1582
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-03 14:51
文章分类

全部博文(180)

文章存档

2014年(6)

2013年(8)

2011年(125)

2009年(35)

2008年(1)

2007年(5)

分类: Oracle

2011-03-31 10:43:12

  1. DECLARE
  2. v_row_delete VARCHAR2(30);
  3. v_empno emp.employee_id%TYPE:=176;
  4. BEGIN
  5. delete from emp where employee_id=v_empno;
  6. v_row_delete:=(SQL%ROWCOUNT||' row deleted.');
  7. DBMS_OUTPUT.PUT_LINE(v_row_delete);
  8. END;
  9. /

delete update ,insert 在pl/sql块里面执行,不会出现sql中统计的数目的,需要使用SQL%ROWCOUNT来显示。

[oracle@dg1 ~]$ sqlplus hr/hr

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 31 10:35:33 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> @2.sql
1 row deleted.

PL/SQL procedure successfully completed.

[oracle@dg1 ~]$ sqlplus hr/hr

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 31 10:35:33 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> @2.sql
1 row deleted.

PL/SQL procedure successfully completed.

 

阅读(2890) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~