Pre-Query Samples
Description
Fires during Execute Query or Count Query processing, just before Form Builder constructs and issues the SELECT statement to identify rows that match the query criteria.
Definition Level form or block
Legal Commands
SELECT statements, unrestricted built-ins
Enter Query Mode no
Usage Notes
Use a Pre-Query trigger to modify the example record that determines which rows will be identified by the query.
On Failure
The query is canceled. If the operator or the application had placed the form in Enter Query mode, the form remains in Enter Query mode.
Fires In
COUNT_QUERY
EXECUTE_QUERY
Open the Query
Prepare the Query
Sample 1
This example validates or modifies query criteria for a database block query.
BEGIN
/*
** Set the ORDER BY clause for the current block
** being queried, based on a radio group
** called 'Sort_Column' in a control block named
** 'Switches'. The Radio Group has three buttons
** with character values giving the names of
** three different columns in the table this
** block is based on:
**
** SAL
** MGR,ENAME
** ENAME
*/
Set_Block_Property('EMP',ORDER_BY, :Switches.Sort_Column);
/*
** Make sure the user has given one of the two
** Columns which we have indexed in their search
** criteria, otherwise fail the query with a helpful
** message
*/
IF :Employee.Ename IS NULL AND :Employee.Mgr IS NULL THEN
Message('Supply Employee Name and/or Manager Id '||
'for Query.');
RAISE Form_Trigger_Failure;
END IF;
/*
** Change the default where clause to either show "Current
** Employees Only" or "Terminated Employees" based on the
** setting of a check box named 'Show_Term' in a control
** block named 'Switches'.
*/
IF Check box_Checked('Switches.Show_Term') THEN
Set_Block_Property('EMP',DEFAULT_WHERE,'TERM_DATE IS NOT NULL');
ELSE
Set_Block_Property('EMP',DEFAULT_WHERE,'TERM_DATE IS NULL');
END IF;
END;
NOTE: call SET_BLOCK_PROPERTY to modify the block's WHERE and ORDER BY clauses from within the Pre-Query trigger, to further restrict or order the records the query will retrieve.Sample 2
Declare
v_where varchar2(2000):='1=1 ';
Begin
If :QUERY_FIND_ORDER.ORDER_ID_FROM is not null then
V_where := v_where || ' and ORDER_ID>='||:QUERY_FIND_ORDER.ORDER_ID_FROM;
end if;
If :QUERY_FIND_ORDER.ORDER_ID_to is not null then
V_where := v_where || ' and ORDER_ID<='||:QUERY_FIND_ORDER.ORDER_ID_to;
end if;
If :QUERY_FIND_ORDER.CUSTOMER_ID_FROM is not null then
V_where := v_where || ' and CUSTOMER_ID>='||:QUERY_FIND_ORDER.CUSTOMER_ID_FROM;
end if;
If :QUERY_FIND_ORDER.CUSTOMER_ID_to is not null then
V_where := v_where || ' and CUSTOMER_ID<='||:QUERY_FIND_ORDER.CUSTOMER_ID_to;
end if;
SET_BLOCK_PROPERTY('DEM_ORDERS_V',DEFAULT_WHERE,v_where);
:PARAMETER.G_QUERY_FIND:='FALSE';
end ;
Sample 3
app_query.reset('loc');
copy_from_parent('LOC', 'PRE-QUERY');
COPY(NAME_IN('PARAMETER.ORG_ID'),'LOC.ORGANIZATION_ID');
--
-- SET THE VALUES FROM THE FIND WINDOW INTO THE LOC BLOCK
-- DO THIS ONLY IF THE QUERY FIND FLAG IS SET TO TRUE
--
IF :PARAMETER.G_QUERY_FIND = 'TRUE' THEN
IF :SYSTEM.CURRENT_FORM = 'INVSDSUB' THEN
:LOC.INVENTORY_LOCATION_ID := :PARAMETER.LOC_ID_QF;
END IF;
FND_FLEX_FIND.QUERY_KFLEX_RANGE('INV','MTLL',101,
:LOCATOR_FIND.LOCATOR_LOW,
:LOCATOR_FIND.LOCATOR_HIGH,
'LOC.LOC_NAME');
IF NAME_IN('LOCATOR_FIND.FIND_LOCATION_ID') IS NOT NULL THEN
COPY (NAME_IN('LOCATOR_FIND.FIND_LOCATION_ID'),'LOC.INVENTORY_LOCATION_ID');
END IF;
IF NAME_IN('LOCATOR_FIND.SUB_INV') IS NOT NULL THEN
COPY(NAME_IN('LOCATOR_FIND.SUB_INV'),'LOC.SUBINVENTORY_CODE');
END IF;
IF NAME_IN('LOCATOR_FIND.LOC_LKUP_MEANING') IS NOT NULL THEN
COPY (NAME_IN('LOCATOR_FIND.LOC_LKUP_CODE'),'LOC.INV_LOC_TYPE');
END IF;
/* If WMS is installed, query based on Material Status also. */
IF NAME_IN('LOCATOR_FIND.STATUS_ID') IS NOT NULL THEN
COPY(NAME_IN('LOCATOR_FIND.STATUS_ID'), 'LOC.STATUS_ID');
END IF;
:PARAMETER.G_QUERY_FIND := 'FALSE' ;
END IF;
FND_FLEX.EVENT('PRE-QUERY');
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[TIL] #8. 프로그래머스 String, Date전달받은 문자열의 길이를 반환한다. 만약 전달받은 문자열 중 하나라도 NULL이 존재하면, NULL을 반환한다. 인수로 전달받은 문자열이 특정 문자열에서 처음 나타나는 위치를 찾아서, 해당 위치를 반환한다. 만약 전...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.