diff --git a/Modules/mip_contact_details.pck b/Modules/mip_contact_details.pck new file mode 100644 index 0000000..0adbaee --- /dev/null +++ b/Modules/mip_contact_details.pck @@ -0,0 +1,87 @@ +CREATE OR REPLACE PACKAGE mip_contact_details IS + + -- Author : MULLENMD + -- Created : 19/12/2007 09:41:54 + -- Purpose : to retrieve contact details for parties + + /** + retrieve a specific contact mechanism for a given party. + + %param p_prty_id the ID of the party + %param p_come_type the contact mechanism type + */ + FUNCTION get_party_contact_detail(p_prty_id IN parties.id%TYPE, + p_come_type IN contact_mechanism_types.code%TYPE) + RETURN contact_mechanisms.contact_value%TYPE; + -- + + /** + retrieve a contact detail based on the ID + + %param p_come_id the contact mechanism ID + */ + FUNCTION get_party_contact_detail_by_id(p_come_id IN contact_mechanisms.id%TYPE) + RETURN contact_mechanisms.contact_value%TYPE; + -- + +END mip_contact_details; +/ +CREATE OR REPLACE PACKAGE BODY mip_contact_details IS + + /** + retrieve a specific contact mechanism for a given party. + + %param p_prty_id the ID of the party + %param p_come_type the contact mechanism type + */ + FUNCTION get_party_contact_detail(p_prty_id IN parties.id%TYPE, + p_come_type IN contact_mechanism_types.code%TYPE) + RETURN contact_mechanisms.contact_value%TYPE IS + -- + l_ret_value contact_mechanisms.contact_value%TYPE; + + BEGIN + SELECT come.contact_value + INTO l_ret_value + FROM parties prty, + party_contact_mechanisms prtycm, + contact_mechanisms come, + contact_mechanism_types comety + WHERE prtycm.come_id = come.id + AND prtycm.prty_id = prty.id + AND come.comt_code = comety.code + AND prty.id = p_prty_id + AND comety.code = p_come_type; + + RETURN l_ret_value; + EXCEPTION + WHEN no_data_found THEN + RETURN NULL; + END get_party_contact_detail; + -- + + /** + retrieve a contact detail based on the ID + + %param p_come_id the contact mechanism ID + */ + FUNCTION get_party_contact_detail_by_id(p_come_id IN contact_mechanisms.id%TYPE) + RETURN contact_mechanisms.contact_value%TYPE IS + -- + l_ret_value contact_mechanisms.contact_value%TYPE; + + BEGIN + SELECT come.contact_value + INTO l_ret_value + FROM contact_mechanisms come + WHERE come.id = p_come_id; + + RETURN l_ret_value; + EXCEPTION + WHEN no_data_found THEN + RETURN NULL; + END get_party_contact_detail_by_id; + -- + +END mip_contact_details; +/