-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path10g_compare_old.sql
More file actions
72 lines (63 loc) · 2.26 KB
/
Copy path10g_compare_old.sql
File metadata and controls
72 lines (63 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
CREATE OR REPLACE PACKAGE emp_coll_pkg
IS
TYPE employee_tt IS TABLE OF employee%ROWTYPE;
FUNCTION equal (coll1_in IN employee_tt, coll2_in IN employee_tt)
RETURN BOOLEAN;
END emp_coll_pkg;
/
CREATE OR REPLACE PACKAGE BODY emp_coll_pkg
IS
FUNCTION equal (coll1_in IN employee_tt, coll2_in IN employee_tt)
RETURN BOOLEAN
IS
l_count1 PLS_INTEGER := coll1_in.COUNT;
l_count2 PLS_INTEGER := coll2_in.COUNT;
l_row PLS_INTEGER := coll1_in.FIRST;
retval BOOLEAN;
FUNCTION row_equal (
row1_in IN employee%ROWTYPE
, row2_in IN employee%ROWTYPE
)
RETURN BOOLEAN
IS
retval BOOLEAN;
BEGIN
retval :=
row1_in.employee_id = row2_in.employee_id
AND row1_in.last_name = row2_in.last_name
AND row1_in.first_name = row2_in.first_name
AND row1_in.middle_initial = row2_in.middle_initial
AND row1_in.job_id = row2_in.job_id
AND row1_in.manager_id = row2_in.manager_id
AND row1_in.hire_date = row2_in.hire_date
AND row1_in.salary = row2_in.salary
AND row1_in.commission = row2_in.commission
AND row1_in.department_id = row2_in.department_id
AND row1_in.empno = row2_in.empno
AND row1_in.ename = row2_in.ename
AND row1_in.created_by = row2_in.created_by
AND row1_in.created_on = row2_in.created_on
AND row1_in.changed_by = row2_in.changed_by
AND row1_in.changed_on = row2_in.changed_on;
RETURN retval;
END row_equal;
BEGIN
retval := l_count1 = l_count2;
IF retval
THEN
LOOP
EXIT WHEN l_row IS NULL OR NOT retval;
retval := row_equal (coll1_in (l_row), coll2_in (l_row));
l_row := coll1_in.NEXT (l_row);
END LOOP;
END IF;
RETURN retval;
END;
END emp_coll_pkg;
/
/*======================================================================
| Supplement to the fifth edition of Oracle PL/SQL Programming by Steven
| Feuerstein with Bill Pribyl, Copyright (c) 1997-2009 O'Reilly Media, Inc.
| To submit corrections or find more code samples visit
| http://oreilly.com/catalog/9780596514464/
*/