I am trying to add some formatted columns to a query to our db, but I think I'm getting the operators wrong in my CASE statement.
I'm also unclear on how to write formatting for the TO_CHAR operation. Is it the same as for the TO_DATE operation? (couldn't find in oracle documentation)
I'm also unsure as to whether I should be using TO_DATE or some other call to create an object that is stored as a time from a string of four numbers.
Most importantly, my code is producing errors so I'm not seeing anything.
I am getting this error:
ORA-00920: invalid relational operator
00920. 00000 - "invalid relational operator"
*Cause:
*Action:
Error at Line: 53 Column: 30
From this code
/* Code written for exercize 3 in the Banner Tutorials by Alex Ackroyd on 18april2013*/
/* Objective: use functions to transform and shape data in the result set*/
/* Tables: SSRMEET ( add to SPRIDEN, SFRSTCR, SSBSECT ) */
/* Select: in addition to the columns from exercize 2, add the following values:
- SSRMEET_ROOM_CODE,
- a computed column for the start time,
- a computed column for the end time, and
- a computed column that shows the days the class meets*/
/* Hint: The computed columns are created by passing table columns through functions.
You can use any non-analytical database function documented by Oracle to transform data from one thing to another.
You can also write your own functions! Whoa there Shadowfax, coming soon to the tutorial near you!*/
/* Note:ssrmeet_begin_time and ssrmeet_end_time are are in a 4 character string 24hr format
so I'm trying to read that in, convert it to a datetime type variable,
then convert it to the final standard format am/pm (ex: 5:00 A.M. , 3:30 P.M., etc.*/
/* Start code from this exercize, 3*/
select
ssrmeet.ssrmeet_room_code,
TO_CHAR(
TO_DATE( ssrmeet.ssrmeet_begin_time, 'HH24MI' )
/*, char format*/
),
TO_CHAR(
TO_DATE( ssrmeet.ssrmeet_end_time, 'HH24MI' )
/*, char format*/
),
CASE
when
/* line 53*/ ssrmeet.ssrmeet_sun_day,
| ssrmeet.ssrmeet_mon_day,
| ssrmeet.ssrmeet_tue_day,
| ssrmeet.ssrmeet_wed_day,
| ssrmeet.ssrmeet_thu_day,
| ssrmeet.ssrmeet_fri_day,
| ssrmeet.ssrmeet_sat_day
IS NOT NULL
END
from ssrmeet
/* End code from this exercize, 3*/
Thanks in advance for any help.