diff --git a/Modules/mip_parties.pck b/Modules/mip_parties.pck index b60e225..84e2032 100644 --- a/Modules/mip_parties.pck +++ b/Modules/mip_parties.pck @@ -1,12 +1,6 @@ CREATE OR REPLACE PACKAGE mip_parties AS - /* - PROCEDURE add_party - - allows an admin user to create new parties for use in the system - %param p_username - the name of the user to create - %param p_password - the password of the party - %p_role - the party's role in the system - */ + FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN; FUNCTION get_user_id(p_username IN VARCHAR2) RETURN NUMBER; FUNCTION get_user_role(p_username IN VARCHAR2) RETURN VARCHAR2; -- @@ -192,6 +186,27 @@ CREATE OR REPLACE PACKAGE mip_parties AS END mip_parties; / CREATE OR REPLACE PACKAGE BODY mip_parties AS + /* + FUNCTION is_tripartite + - This function searches the parties table with the supplied + - mktp_ref and returns true if the tripartite member column is yes. + %param p_mktp_ref - the market participant (supplier) to check. + */ + FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN AS + l_tripartite_status varchar2(3); + CURSOR c_tripartite IS + SELECT distinct tripartite_member FROM parties WHERE upper(mktp_ref) = upper(p_mktp_ref); + BEGIN + OPEN c_tripartite; + FETCH c_tripartite + INTO l_tripartite_status; + CLOSE c_tripartite; + if upper(l_tripartite_status) = 'YES' then + return TRUE; + else + return FALSE; + end if; + END is_tripartite; /* FUNCTION get_user_id - gets the primary key for a supplied username. This function searches the parties