-1到100在SQL中顯示'Fizz'如果數字可以被3整除'Buzz'如果可以被5整除並且'FizzBuzz'被兩個整除。下面是我的代碼Fizz嗡嗡聲SQL邏輯錯誤
select
Case when Remainder (rownum,3)=0 then 'Fizz'
when Remainder (rownum,5)=0 then 'Buzz'
when (remainder (rownum,3)=0 and remainder(ROWNUM,5) = 0) then 'FizzBuzz'
else rownum end
from DUAL
Connect by level <=100;
它給了我錯誤 - ORA-00932:不一致的數據類型:預期CHAR了NUMBER 00932. 00000 - 「不一致的數據類型:有望%S得了%的」 *原因:
*行動: 錯誤在行:5列:18
投的ROWNUM爲VARCHAR2 – Quassnoi
[代碼高爾夫球:1,2, Fizz,4,Buzz](http://codegolf.stackexchange.com/a/58969/15968) – MT0