16: BEGIN
17: x_exception_msg := 'pos_create_relationship():select object_type';
18: select party_type
19: into l_object_type
20: from hz_parties
21: where party_id = p_object_id;
22:
23: x_exception_msg := 'select subject_type';
24: select party_type
22:
23: x_exception_msg := 'select subject_type';
24: select party_type
25: into l_subject_type
26: from hz_parties
27: where party_id = p_subject_id;
28:
29: x_exception_msg := 'Calling the pos_hz_create_relationship';
30: pos_hz_create_relationship( p_subject_id => p_subject_id
32: , p_relationship_type => p_relationship_type
33: , p_relationship_code => p_relationship_code
34: , p_party_object_type => l_object_type
35: , p_party_subject_type => l_subject_type
36: , p_subject_table_name => 'HZ_PARTIES'
37: , p_object_table_name => 'HZ_PARTIES'
38: , p_relationship_status => 'A'
39: , p_relationship_start_date => NULL
40: , p_relationship_end_date => NULL
33: , p_relationship_code => p_relationship_code
34: , p_party_object_type => l_object_type
35: , p_party_subject_type => l_subject_type
36: , p_subject_table_name => 'HZ_PARTIES'
37: , p_object_table_name => 'HZ_PARTIES'
38: , p_relationship_status => 'A'
39: , p_relationship_start_date => NULL
40: , p_relationship_end_date => NULL
41: , x_party_relationship_id => x_party_relationship_id
348: BEGIN
349: x_exception_msg := 'pos_outdate_relationship():select object_type';
350: select party_type
351: into l_object_type
352: from hz_parties
353: where party_id = p_object_id;
354:
355: x_exception_msg := 'select subject_type';
356: select party_type
354:
355: x_exception_msg := 'select subject_type';
356: select party_type
357: into l_subject_type
358: from hz_parties
359: where party_id = p_subject_id;
360:
361: x_exception_msg := 'selecting distinct relationship id';
362:
365: from hz_relationships
366: where start_date <= sysdate
367: and end_date >= sysdate
368: and status = 'A'
369: and object_table_name = 'HZ_PARTIES'
370: and subject_table_name = 'HZ_PARTIES'
371: and object_type = l_object_type
372: and subject_type = l_subject_type
373: and relationship_code = p_relationship_code
366: where start_date <= sysdate
367: and end_date >= sysdate
368: and status = 'A'
369: and object_table_name = 'HZ_PARTIES'
370: and subject_table_name = 'HZ_PARTIES'
371: and object_type = l_object_type
372: and subject_type = l_subject_type
373: and relationship_code = p_relationship_code
374: and relationship_type = p_relationship_type
381: , p_relationship_type => p_relationship_type
382: , p_relationship_code => p_relationship_code
383: , p_party_object_type => l_object_type
384: , p_party_subject_type => l_subject_type
385: , p_subject_table_name => 'HZ_PARTIES'
386: , p_object_table_name => 'HZ_PARTIES'
387: , p_relationship_end_date => SYSDATE
388: , p_relationship_start_date => NULL
389: , p_relationship_id => l_relationship_id
382: , p_relationship_code => p_relationship_code
383: , p_party_object_type => l_object_type
384: , p_party_subject_type => l_subject_type
385: , p_subject_table_name => 'HZ_PARTIES'
386: , p_object_table_name => 'HZ_PARTIES'
387: , p_relationship_end_date => SYSDATE
388: , p_relationship_start_date => NULL
389: , p_relationship_id => l_relationship_id
390: , p_object_version_number => l_obj_ver