Delimiter //
/**
 *
 * @param int batchnum
 * @return void
*/
Drop Procedure if exists LOADER_CONTACTS_NORMALIZE_CONTACT_REF_IS_UNIQUE//

Create Procedure LOADER_CONTACTS_NORMALIZE_CONTACT_REF_IS_UNIQUE (
    In batchnum int
)
Begin
    Set @flagCountField='LOADER_CONTACTS_ERRCOUNT';
    Set @flagMsgField='LOADER_CONTACTS_ERRMSGS';
    Set @lastStatusField=null;
    Set @lastStatus=null;

    call LOADER_CHECK_UNIQUE (
	'LOADER_CONTACTS'
	, 'CONTACTS_REF'
	, null
	, 'LOADER_CONTACTS_BATCH_NUM'
	, batchnum
	, @flagCountField
        , @flagMsgField
        , @lastStatusField
        , @lastStatus
    );

End //

Delimiter ;