1 PACKAGE BODY PO_ASL_DOCUMENTS_SV as
2 /* $Header: POXA8LSB.pls 120.1 2007/12/12 09:00:45 irasoolm noship $ */
3
4 /*=============================================================================
5
6 FUNCTION NAME: check_record_unique
7
8 =============================================================================*/
9 function check_record_unique(x_asl_id number,
10 x_using_organization_id number,
11 x_sequence_num number,
12 x_document_header_id number,
13 x_record_status varchar2) return boolean is --bug 6504696
14
15 x_dummy_count NUMBER := 0;
16
17 begin
18
19 -- Check for duplicate sequence numbers for this asl_id
20 -- and using_organization_id. The uniqueness constraint
21 -- on document_header_id is enforced by a unique index.
22
23 SELECT count(1)
24 INTO x_dummy_count
25 FROM PO_ASL_DOCUMENTS
26 WHERE x_asl_id = asl_id
27 AND x_using_organization_id = using_organization_id
28 AND (x_sequence_num = sequence_num
29 OR x_document_header_id = document_header_id);
30
31 -- IF x_dummy_count > 0 THEN
32 -- bug 6504696
33 -- Modified the below if statement such that to return false if existing records get modified with duplicated values
34 -- or new records with the duplicated values
35 IF (x_dummy_count > 0 AND x_record_status = 'INSERT') OR (x_dummy_count > 1 AND x_record_status <> 'INSERT') THEN
36 return(FALSE);
37 ELSE
38 return(TRUE);
39 END IF;
40
41 exception
42 when others then
43 raise;
44 end;
45
46 END PO_ASL_DOCUMENTS_SV;