我能否知道解码语句有什么问题,我想做的是:
if ((((PRESENT + (LATE/3))/PRESENT + LATE + ABSENT) * (100)) > 80)
{
exam_entry = 'YES';
}
else
{
exam_entry = 'NO'
}
我的解码声明是:
DECODE (TRUE,
(
(
(PRESENT + (LATE/3))/PRESENT + LATE + ABSENT
)*(100)
) >80,
'YES',
'NO') AS exam_entry
答案 0 :(得分:0)
对于指定条件,您可以使用case
when
then
条款 -
CASE
WHEN ((((PRESENT + (LATE/3))/PRESENT + LATE + ABSENT) * (100)) > 80)
then
'YES';
else
'NO'
END as exam_entry
如果你必须使用解码,你可以使用如下 -
decode(sign(80 - (((PRESENT + (LATE / 3)) / PRESENT + LATE + ABSENT) *
(100))),
-1,
'YES',
'NO') AS exam_entry