SQL>
SQL> CREATE TABLE employee (
2 emp_id NUMBER,
3 last_name VARCHAR2(30),
4 first_name VARCHAR2(30),
5 salary NUMBER
6 );
Table created.
SQL>
SQL>
SQL> INSERT INTO employee (emp_id, last_name, first_name, salary)VALUES (1, 'G', 'J', 100000);
1 row created.
SQL>
SQL> INSERT INTO employee (emp_id, last_name, first_name, salary)VALUES (2, 'G', 'H', 100000);
1 row created.
SQL>
SQL>
SQL>
SQL> DECLARE
2 employee_rowid UROWID;
3 employee_salary NUMBER;
4 BEGIN
5 SELECT rowid, salary INTO employee_rowid, employee_salary
6 FROM employee
7 WHERE last_name='G' AND first_name='J';
8
9 UPDATE employee
10 SET salary = employee_salary
11 WHERE last_name='G' AND first_name='J';
12 END;
13 /
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
SQL> drop table employee;
Table dropped.
SQL>
SQL>
|