1 PACKAGE BODY PER_IMAGES_PKG as
2 /* $Header: peimg01t.pkb 115.0 99/07/18 13:54:12 porting ship $ */
3 --
4 procedure check_unique(p_table_name VARCHAR2
5 ,p_parent_id NUMBER) is
6 --
7 -- Ensure that only one combination of
8 -- table_name,parent_id can exist in the images table
9 --
10 cursor img_cur is
11 select 'Y'
12 from per_images
13 where table_name = p_table_name
14 and parent_id = p_parent_id;
15 ---
16 -- local variables
17 --
18 l_exists varchar2(1);
19 begin
20 open img_cur;
21 fetch img_cur into l_exists;
22 if img_cur%FOUND then
23 FND_MESSAGE.SET_NAME('801','PER_7901_SYS_DUPLICATE_RECORDS');
24 APP_EXCEPTION.RAISE_EXCEPTION;
25 end if;
26 close img_cur;
27 end check_unique;
28 --
29 procedure get_sequence_no(p_image_id IN OUT NUMBER) is
30 --
31 -- Return next sequence number for insert
32 -- of image.
33 --
34 cursor get_seq is
35 select per_images_s.nextval
36 from sys.dual;
37 begin
38 open get_seq;
39 fetch get_seq into p_image_id;
40 close get_seq;
41 end get_sequence_no;
42 procedure insert_row (p_image_id IN OUT NUMBER
43 ,p_table_name VARCHAR2
44 ,p_parent_id NUMBER) is
45 --
46 -- Run Procedures required at insert.
47 --
48 begin
49 per_images_pkg.check_unique(p_table_name =>p_table_name
50 ,p_parent_id =>p_parent_id);
51 per_images_pkg.get_sequence_no(p_image_id => p_image_id);
52 end insert_row;
53 END PER_IMAGES_PKG;