【发布时间】:2012-02-19 02:45:56
【问题描述】:
我在使用这个 sql 视图时遇到了一点问题。
CREATE OR REPLACE VIEW view_themed_booking AS
SELECT tb.*,
CASE
WHEN (tb.themed_party_size % 2) = 0 THEN
(tb.themed_party_size-2)/2
ELSE ((tb.themed_party_size-2)/2) + 0.5
END themed_tables
FROM themed_booking tb;
有人可以帮我吗?我正在尝试在 (S-2)/2 的自然数结果的视图末尾添加一列,其中 S 是 themed_party_size。
当我说自然数结果时,我的意思是把以 .5 结尾的答案四舍五入,所以如果 S=7 答案将是 3 而不是 2.5。
我尝试运行上述代码时遇到的错误是
Error starting at line 1 in command:
CREATE OR REPLACE VIEW view_themed_booking AS
SELECT tb.*,
CASE WHEN (tb.themed_party_size % 2) = 0
THEN (tb.themed_party_size-2)/2
ELSE ((tb.themed_party_size-2)/2) + 0.5
END themed_tables
FROM themed_booking tb
Error at Command Line:3 Column:34
Error report:
SQL Error: ORA-00911: invalid character
00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than
letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain
any character other than a doublequote. Alternative quotes
(q'#...#') cannot use spaces, tabs, or carriage returns as
delimiters. For all other contexts, consult the SQL Language
Reference Manual.
*Action:
如果有什么不同,我正在使用连接到 oracle 服务器的 sqldeveloper,这样我就可以使用 PL/SQL。
【问题讨论】:
-
哈哈哦抱歉忘记添加错误了!
标签: sql oracle view plsql ora-00911