我對這個sql視圖有點麻煩。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:
如果它的確與衆不同,我使用的SQLDeveloper連接到Oracle服務器,所以我可以使用PL/SQL。
哈哈哦對不起忘了加上錯誤! – geekman92 2012-02-19 02:53:11