Question

Locked

Oracle CASE missing keyword error ?

By ratface ·
When trying to run a piece of code I get ora-00905 missing keyword
I marked the line that gives thw error. Thanks

code:
(CASE
WHEN (EOQ) - ((CASE ps.payment_schedule_date
When '00000000'
then TO_DATE(To_NUMBER(pl.pledge_year_of_giving + 5)||'0630','YYYY/MM/DD')
Else TO_DATE(ps.payment_schedule_date,'YYYY/MM/DD')
end)) < to_char(180) THEN
-- ++++++++++++++++++++++++++++++ ERROR HERE
round(ps.payment_schedule_balance*(pl.pledge_amount/pp.prim_pledge_amount),12) amount
END ) 'Current' ,
(CASE
WHEN (EOQ) - ((CASE ps.payment_schedule_date
When '00000000'
then TO_DATE(To_NUMBER(pl.pledge_year_of_giving + 5)||'0630','YYYY/MM/DD')
Else TO_DATE(ps.payment_schedule_date,'YYYY/MM/DD')

end)) between to_char(180) and to_char(365)then ' 6 months - 1 Yr Past Due'
END ),
(CASE
WHEN (EOQ) - ((CASE ps.payment_schedule_date
When '00000000'
then TO_DATE(To_NUMBER(pl.pledge_year_of_giving + 5)||'0630','YYYY/MM/DD')
Else TO_DATE(ps.payment_schedule_date,'YYYY/MM/DD')
end)) between to_char(366) and to_char(730) THEN '1 Yr - 2 Yrs Past Due'
END) ,
(CASE
WHEN (EOQ ) - ((CASE ps.payment_schedule_date
When '00000000'
then TO_DATE(To_NUMBER(pl.pledge_year_of_giving + 5)||'0630','YYYY/MM/DD')
Else TO_DATE(ps.payment_schedule_date,'YYYY/MM/DD')
end)) > to_char(730) THEN '2 Yrs - 3 Yrs Past Due'
END)

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Off the top of my head

by robo_dev In reply to Oracle CASE missing keywo ...

have you nested the correct number of parenthethes?

Remember a case statement stops at the first true statement.

Typically a missing 'end' causes that error. So I am not sure the "< to_char(180) THEN" after the end is syntactically consistent.

Collapse -

Parentheses woud be my pick as well

by Tony Hopkinson In reply to Oracle CASE missing keywo ...

Same place as Robodev.
Where you have two befiore the inner case and two after it's end, redundant or wrong...
You might want to have a look at some functions for this, wold nake it much more readable and therefore maintainable.

Back to IT Employment Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums