Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using decode in where clause

944524Jun 19 2015 — edited Jun 22 2015

Hi,

I need to use decode condition in where clause in such a way that if the respective column is null then consider the corresponding column

for eg

  

Fee_dateFee_refund_date
10-OCT-05
12-NOV-05
11-JAN-06
16-FEB-06

i have a query in place like below where p_fee_flag will be passed as either FEE or null i need to check another condition like if p_fee_flag is null then fee_date should be null when comparing fee_refund_date between TRUNC(BKT.ACT_START_DATE) AND TRUNC(BKT.ACT_END_DATE

SELECT 1

  FROM BUCKET BKT

  WHERE DECODE(P_FEE_FLAG,'FEE',TRUNC(FS.FEE_DATE),TRUNC(FS.FEE_REFUND_DATE))

  BETWEEN TRUNC(BKT.ACT_START_DATE) AND TRUNC(BKT.ACT_END_DATE)

This post has been answered by AlbertoFaenza on Jun 22 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2015
Added on Jun 19 2015
12 comments
6,619 views