875: p_requestor := '';
876: if(p_document_type = 'STANDARD') then
877: select count(1) into l_count_distinct from (
878: select distinct(deliver_to_person_id)
879: from po_distributions_archive_all pda
880: where pda.po_header_id = p_header_id
881: and pda.po_line_id = p_line_id
882: and pda.revision_num = p_revision_num);
883:
882: and pda.revision_num = p_revision_num);
883:
884: if( l_count_distinct = 1) then
885: select distinct(deliver_to_person_id) into l_agent_id
886: from po_distributions_archive_all pda
887: where pda.po_header_id = p_header_id
888: and pda.po_line_id = p_line_id
889: and pda.revision_num = p_revision_num;
890:
896: end if;
897: end if;
898: else -- Release
899: select count(1) into l_count_distinct from (
900: select distinct(deliver_to_person_id) from po_distributions_archive_all pda
901: where pda.po_header_id = p_header_id
902: and pda.po_line_id = p_line_id
903: and pda.revision_num = p_revision_num
904: and pda.po_release_id = p_release_num);
903: and pda.revision_num = p_revision_num
904: and pda.po_release_id = p_release_num);
905:
906: if( l_count_distinct = 1) then
907: select distinct(deliver_to_person_id) into l_agent_id from po_distributions_archive_all pda
908: where pda.po_header_id = p_header_id
909: and pda.po_line_id = p_line_id
910: and pda.revision_num = p_revision_num
911: and pda.po_release_id = p_release_num;
1011: and po_line_id = p_line_id
1012: and revision_num <= p_revision_num;
1013:
1014: select max(revision_num) into l_max_distribution_revision
1015: from po_distributions_archive_all
1016: where po_header_id = p_header_id
1017: and po_line_id = p_line_id
1018: and revision_num <= p_revision_num;
1019:
1079: and line_location_id = p_location_id
1080: and revision_num <= p_revision_num;
1081:
1082: select max(revision_num) into l_max_dist_revision
1083: from po_distributions_archive_all
1084: where po_header_id = p_header_id
1085: and po_line_id = p_line_id
1086: and line_location_id = p_location_id
1087: and revision_num <= p_revision_num;