1

请告诉我查询有什么问题。我正在使用 Pro C。

EXEC SQL SELECT 1
        INTO    :db_count
        FROM    sachin t
        WHERE   t.serialno =   :serial_no
        AND     t.amount = (:db_inamount - (SELECT NVL(overrun_amount,0)
                                            FROM  sunny tovrun
                                            WHERE tovrun.serialno = :serial_no
                                            AND   tovrun.timestamp = t.timestamp
                                            AND   rownum < 2)
                            )
        AND     t.request_code = 11
        AND     t.reason_code = 0
        AND     t.reversed    = 0
        AND rownum < 2;

并得到编译错误

Syntax error at line 4487, column 42, file my_file.pc:
Error at line 4487, column 42 in file my_file.pc            AND             t.amount = (:db_inamount - (SELECT NVL(overrun_amount,0)
4

1 回答 1

2

利用:

 AND t.amount = (SELECT :db_amount - NVL(overrun_amount, 0) ...

t.amount这是一个标准计算列,其中的值是在与相等值进行比较之前计算的。

于 2009-12-31T08:39:08.697 回答