Case Statement In Oracle Reports Query [message #587182] |
Thu, 13 June 2013 00:40 |
|
SandeepS
Messages: 15 Registered: April 2013
|
Junior Member |
|
|
Hi All,
Can I use CASE statement Inside a Oracle Report Query.
I'm using Oracle Reports Builder 10g.
My Report Query looks like this,
select invh_code, invh_number, invh_date, invh_cm_code, im_description
from invoice_head, invoice_det, unit_of_measurement, item_master
where invd_invh_code = invh_code and im_code = invd_item_code
AND
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4)) BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)
else 1
end)
order by invh_number
:p_flag is a parameter that i pass from oracle form and based on that value (:p_flag=1) i need to include this specific condition
else omit that condition.
But the CASE statement is throwing Error
ORA-00907 :Missing Right Paranthesis
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4))
==> BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)
Can anyone Please Help....
Sandeep
--Every negative event has within it the seed of an equal or greater benefit
[Updated on: Thu, 13 June 2013 00:43] Report message to a moderator
|
|
|
|
|
|
Re: Case Statement In Oracle Reports Query [message #587291 is a reply to message #587236] |
Thu, 13 June 2013 23:08 |
|
SandeepS
Messages: 15 Registered: April 2013
|
Junior Member |
|
|
Hi LittleFoot,
Thank You for your Reply..
If :p_flag = 1, then means I want to include that condition [substr(invd_item_number,0,(length(invd_item_number)-4)) BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)], if :p_flag is set
else I don't want this condition to be included, ie I don't want the records to be filtered out...
that's why i used CASE statement
Thanks
Sandeep
--Every negative event has within it a seed of an equal or greater benefit.
[Updated on: Thu, 13 June 2013 23:12] Report message to a moderator
|
|
|
|
|