|
List Info
Thread: RE: Is this possible with query in post_query trigger?
|
|
| RE: Is this possible with query in
post_query trigger? |
  United States |
2008-09-21 12:50:39 |
|
Everything on the right side of the equality operator is considered to be a value in your example.
All of this gets concatenated as a text value: :BUD_QRY.A_BUD_YR || center_qry||costitem_qry||allo_qry || req_by_qry
Try this instead: begin
select sum(subtotal) into :tot.subtotal from vw_reqlst08 where BUD_YEAR= :BUD_QRY.A_BUD_YR and (:BUD_QRY.CENTER_ID is null or :BUD_QRY.CENTER_ID is not null and CENTER_ID= :BUD_QRY.CENTER_ID) and (:BUD_QRY.costitem is null or :BUD_QRY.costitem is not null and and cost_item_id = :BUD_QRY.costitem) and (:BUD_QRY.allo is null or :BUD_QRY.allo is not null and allo_id = :BUD_QRY.allo) and :BUD_QRY.req_by is null or :BUD_QRY.req_by is not null and req_by = :BUD_QRY.req_by)
end;
From: Alan Kong <kkkong ee.cuhk.edu.hk> Reply-To: ODTUG-SQLPLUS-L fatcity.com To: Multiple recipients of list ODTUG-SQLPLUS-L <ODTUG-SQLPLUS-L fatcity.com> Subject: Is this possible with query in post_query trigger? Date: Fri, 19 Sep 2008 02:30:39 -0800 Hi, I have the following statements in my post-query trigger. The query returns correctly when the ONLY the :BUD_QRY.A_BUD_YR is not null. Nothing returned when the rest of other fields were not NULL. Can I have a query like it?
Thank you. Regards Alan
DECLARE blk_id BLOCK; final_qry varchar2(4000); center_qry varchar2(50); costitem_qry
varchar2(50); allo_qry varchar2(50); req_by_qry varchar2(50); begin blk_id :=Find_block('VW_REQLST08');
:tot.subtotal:=NULL;
if :BUD_QRY.CENTER_ID is not null then center_qry:=' and CENTER_ID= :BUD_QRY.CENTER_ID'; end if;
if :BUD_QRY.costitem is not null then costitem_qry:=' and cost_item_id = :BUD_QRY.costitem'; end if;
if :BUD_QRY.allo is not null then allo_qry:=' and allo_id =
:BUD_QRY.allo'; end if; if :BUD_QRY.req_by is not null then req_by_qry:=' and req_by = :BUD_QRY.req_by'; end if; /* final_qry := 'BUD_YEAR= :BUD_QRY.A_BUD_YR ' || center_qry||costitem_qry||allo_qry || req_by_qry;*/
select sum(subtotal) into :tot.subtotal from vw_reqlst08 where BUD_YEAR= :BUD_QRY.A_BUD_YR || center_qry||costitem_qry||allo_qry || req_by_qry;
end;
-- For more information on this topic or to become a member, visit our Web site at http://www.ODTUG.com
Join ODTUG for The PL/SQL and The APEX Expert Gathering of the Year! OPP2008 and APEXposed! 2008 will be held on October 29-30,
2008 at the Wyndham O'Hare, Chicago. Visit www.odtugopp.com or www.odtugapextraining.com for more details.
-- Author: Alan Kong INET: kkkong ee.cuhk.edu.hk
Fat City Hosting, San Diego, California -- http://www.fatcity.com --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ODTUG-SQLPLUS-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--
For more information on this topic or to become a member, visit our Web site at http://www.ODTUG.com
Join ODTUG for The PL/SQL and The APEX Expert Gathering of the Year! OPP2008 and APEXposed! 2008 will be held on October 29-30, 2008 at the Wyndham O'Hare, Chicago. Visit www.odtugopp.com or www.odtugapextraining.com for more details.
--
Author: Raymond De Bruyn
INET: rdebruyn sympatico.ca
Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ODTUG-SQLPLUS-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|