我想添加一些格式化的列到我们的数据库查询,但我想我得到的CASE语句中的操作符错误。SQL开发人员:无效的关系运算符错误,也格式化问题
我也不清楚如何编写TO_CHAR操作的格式。是否与TO_DATE操作相同? (在oracle文档中找不到)
我也不确定是否应该使用TO_DATE或其他一些调用来创建一个对象,该对象作为时间存储为四个数字的字符串。
最重要的是,我的代码产生错误,所以我什么也没看到。
我收到此错误:
ORA-00920: invalid relational operator
00920. 00000 - "invalid relational operator"
*Cause:
*Action:
Error at Line: 53 Column: 30
从这个代码
/* 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*/
预先感谢任何帮助。
+0
什么样的数据类型是'ssrmeet_begin_time'?在'DATE'列上应用'to_date()'完全没用。 –