

-- Stored Procedure for Insertion of Secondary Parent details.

-- Wm. G. Urquhart 8th May, 2002

-- For PostgreSQL v7.2.1

-- Version 1.0



CREATE OR REPLACE FUNCTION apply_partner_details(integer, integer, varchar, varchar) RETURNS INTEGER AS '

DECLARE

    id ALIAS FOR $1 ;

    stitle ALIAS FOR $2 ;

    sforename ALIAS FOR $3 ;

    ssurname ALIAS FOR $4 ;

    nRowCount integer := 0 ;

    nRowOID OID := 0 ;



BEGIN

    IF (id = 0) THEN

        RETURN 0 ;

    ELSE

        UPDATE "Parents" SET "STitle" = stitle, "SForename" = sforename, "SSurname" = ssurname WHERE ("ID" = id) ;

        GET DIAGNOSTICS nRowCount = ROW_COUNT ;

    END IF ;

    RETURN nRowCount ; 

END ;

' LANGUAGE 'plpgsql' WITH(iscachable, isstrict) ;





