/***************************************************************************** * * NAME: PRE-QUERY * LEVEL: BLOCK * BLOCK: POS_SEARCH_RESULTS * * DESCRIPTION: * Pre query. * * MODIFICATION HISTORY * NAME DATE DESCRIPTION * =================== ======== ============================================== * *****************************************************************************/ DECLARE vc_status VARCHAR2(20); BEGIN vc_status := GET_BLOCK_PROPERTY('POS_SEARCH_RESULTS', status); /* * Assign value of store number in results block to store number in criteria * block where store number not null. */ IF :POS_SEARCH_CRITERIA.store_no IS NOT NULL THEN :POS_SEARCH_RESULTS.store_no := :POS_SEARCH_CRITERIA.store_no; END IF; /* * Assign value of occasion id in results block to occasion id in criteria * block where occasion id not null. */ IF :POS_SEARCH_CRITERIA.occasion_id IS NOT NULL THEN :POS_SEARCH_RESULTS.occasion_id := :POS_SEARCH_CRITERIA.occasion_id; END IF; /* * Assign value of fixed in results block to fixed in criteria * block where fixed not null. */ IF :POS_SEARCH_CRITERIA.fixed IS NOT NULL THEN :POS_SEARCH_RESULTS.fixed := :POS_SEARCH_CRITERIA.fixed; END IF; IF :POS_SEARCH_CRITERIA.from_date IS NOT NULL THEN IF :POS_SEARCH_CRITERIA.to_date IS NOT NULL THEN /* * Where valid dates are found in date fields, copy all dates between these criteria. */ copy( '# BETWEEN to_date('''||to_char(:POS_SEARCH_CRITERIA.from_date)||''') AND to_date('''||to_char(:POS_SEARCH_CRITERIA.to_date)||''')','POS_SEARCH_RESULTS.process_date'); ELSE /* * Where from date has contents and to date is null, * copy all dates greater than from date. */ copy( '# >= to_date('''||to_char(:POS_SEARCH_CRITERIA.from_date)||''')','POS_SEARCH_RESULTS.process_date'); END IF; ELSE IF :POS_SEARCH_CRITERIA.to_date IS NOT NULL THEN /* * Where to date has contents and from date is null, * copy all dates less than to date. */ copy( '# <= to_date('''||to_char(:POS_SEARCH_CRITERIA.to_date)||''')','POS_SEARCH_RESULTS.process_date'); END IF; END IF; /* * Copy all exceptions where the validation number is null. If the validation_no is NOT NULL * this is an exception aimed at the GB consultants otherwise it is aimed at support. */ copy( '# IS NULL','POS_SEARCH_RESULTS.validation_no'); END;