Compile time Error in ProC (Embedded sql in C)
Please tell me whats wrong with the query. I am using 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;
And getting the compilation errors
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)
Use:
AND t.amount = (SELECT :db_amount - NVL(overrun_amount, 0) ...
It's a standard computed column, where the value is calculated prior to the comparison to the t.amount
value for equality.
精彩评论