|
|
|
|
Re: Unable to fetch data using control-blocks [message #487462 is a reply to message #487400] |
Mon, 27 December 2010 07:47 |
|
tramc1234
Messages: 3 Registered: December 2010 Location: india
|
Junior Member |
|
|
Hi,
first of all thanks for your feedback.
please find the code below,which has been hard coded in PRE_QUERY.
:GLOBAL.DFROMDT := NULL;
:GLOBAL.DTODT := NULL;
IF :HEADER_BLOCK.NBTFROMDT is NULL THEN
SELECT TO_DATE('10'||'/'||TO_CHAR(ADD_MONTHS(SYSDATE,-1),'MM')||'/'||
TO_CHAR(ADD_MONTHS(SYSDATE,-12),'YYYY'),'DD/MM/YYYY')
INTO :HEADER_BLOCK.NBTFROMDT FROM SYS.DUAL ;
END IF;
IF :HEADER_BLOCK.NBTTODT IS NULL THEN
SELECT SYSDATE INTO :HEADER_BLOCK.NBTTODT
FROM SYS.DUAL;
END IF;
IF :HEADER_BLOCK.NBTFROMDT IS NOT NULL
OR :HEADER_BLOCK.NBTTODT IS NOT NULL THEN
:GLOBAL.DFROMDT := :HEADER_BLOCK.NBTFROMDT;
:GLOBAL.DTODT := :HEADER_BLOCK.NBTTODT;
END IF;
IF :DETAIL_BLOCK.nbtFjdDrCrInd IS NOT NULL THEN
svWhere_String := 'WHERE VCHR_DT BETWEEN '''||nvl(:GLOBAL.DFROMDT,TO_DATE(:GLOBAL.DFROMDT,'DD/MM/YYYY'))||''' AND '||
''''||NVL(:GLOBAL.DTODT,TO_DATE(SYSDATE,'DD/MM/YYYY'))||''')';
Set_Block_Property('DETAIL_BLOCK',DEFAULT_WHERE,svWhere_String);
ELSE
Set_Block_Property('DETAIL_BLOCK',DEFAULT_WHERE,' ');
END IF;
WHEN-BUTTON-PRESSED behind the "fetch" has EXECUTE_QUERY.
CM: added [code] tags, please do so yourself next time, see the orafaq forum guide if you're not sure how.
[Updated on: Mon, 27 December 2010 13:38] by Moderator Report message to a moderator
|
|
|
Re: Unable to fetch data using control-blocks [message #487467 is a reply to message #487462] |
Mon, 27 December 2010 13:44 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I assume this pre-query is on the detail block.
Some points:
1) The select from dual's are unecessary - you can assign those values without a select.
2) This;
IF :HEADER_BLOCK.NBTFROMDT IS NOT NULL
OR :HEADER_BLOCK.NBTTODT IS NOT NULL THEN
Is pointless, since you've made sure it must always be true, there really is no point checking.
3) The final If makes no sense to me. Why would you be a checking if an item in the detail block is populated in the pre-query trigger?
|
|
|
|