我有下表
A B C
20 20 23
20 20 20
20 21 22
13 14 30
命名三角形,如果三角形是等边的、等腰的、不等边的或不是三角形,我每次都需要输出。
我使用了以下代码:
select A,B,C,
case
when A = B = C then'Equilateral'
when A + B < C then "Not A Triangle"
when (A = B and B != C) or (A = C and B != A) or ( B = C and A != B ) then "Isoceles"
else "Scalene"
end,
from Triangles;
但我收到此错误:
when A = B = C then'Equilateral'
*
ERROR at line 3:
ORA-00905: missing keyword
这是因为你必须把那些单独作为A = B
和B = C
和移除,
后end
(因为你没有更多的列)
select A,B,C,
case
when A = B and B = C then'Equilateral'
when A + B < C then 'Not A Triangle'
when (A = B and B != C) or (A = C and B != A) or ( B = C and A != B ) then 'Isoceles'
else 'Scalene'
end
from Triangles;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句