SQL>
SQL>
SQL>
SQL> CREATE TABLE departments
2 (department_id number(10) not null,
3 department_name varchar2(50) not null,
4 CONSTRAINT departments_pk PRIMARY KEY (department_id)
5 );
Table created.
SQL>
SQL>
SQL>
SQL> insert into departments ( department_id, department_name )
2 values( 1, 'Data Group' );
1 row created.
SQL>
SQL> insert into departments ( department_id, department_name )
2 values( 2, 'Purchasing' );
1 row created.
SQL>
SQL> insert into departments ( department_id, department_name )
2 values( 3, 'Call Center' );
1 row created.
SQL>
SQL> insert into departments ( department_id, department_name )
2 values( 4, 'Communication' );
1 row created.
SQL>
SQL>
SQL> declare
2 begin
3 update departments
4 set department_name = department_name
5 where 1 = 2;
6
7 dbms_output.put ('An update with a WHERE clause 1 = 2 effects ');
8 dbms_output.put_line(sql%rowcount || ' records.');
9
10 update departments
11 set department_name = department_name;
12
13 dbms_output.put('No WHERE clause in an update effects ');
14 dbms_output.put_line(sql%rowcount || ' records.');
15 end;
16 /
An update with a WHERE clause 1 = 2 effects 0 records.
No WHERE clause in an update effects 4 records.
PL/SQL procedure successfully completed.
SQL>
SQL> drop table departments;
Table dropped.
SQL>
|