| case [message #635445] |
Mon, 30 March 2015 09:13  |
 |
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo all..
I am trying to use the case in my where clause, but having Problem with error number:
ORa:00905-keyword missing
I am trying my following test query:
select item1, item2, item3, item4, in_date
from table1, table2
where item1 = table1.item1
and case
when table2.in_date is null then sysdate
when table2.in_date is not null then table2.in_date
end
;
I want to select if in_date is empty then should give me sysdate, if not then the value in it.
can anyone please help me?
thanking you in advance
regards,
|
|
|
|
| Re: case [message #635446 is a reply to message #635445] |
Mon, 30 March 2015 09:16   |
John Watson
Messages: 9003 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
|
You need to put your CASE statement inthe column projection list, not in the predicate.
|
|
|
|
|
|
| Re: case [message #635448 is a reply to message #635447] |
Mon, 30 March 2015 09:22   |
John Watson
Messages: 9003 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
You need to go back to the basics of SQL. Do you know what a "predicate" is? Do you understand the terms "column projection" and "row selection"?
|
|
|
|
|
|
|
|
|
|
|
|