Subject | Coalesce Help in Stored Procedure |
---|---|
Author | Muthu Annamalai |
Post date | 2004-08-23T16:13:02Z |
Hi Luc:
Look into the following Stored Procedure
SELECT COALESCE(SUM(AMOUNT),0) FROM RECEIPT
WHERE CAST(RECEIPTDATE AS DATE) = :SALESDAY AND
PAYMENTID =7
INTO :CHECKSALES;
This is part of the same stored procedure, this is actually
returning zero if there is no matching row in table. Here the table
is different table, but for given salesday there is no record.
And I still didn't initialize the variable
I am confused here.
Regards,
Muthu
Look into the following Stored Procedure
SELECT COALESCE(SUM(AMOUNT),0) FROM RECEIPT
WHERE CAST(RECEIPTDATE AS DATE) = :SALESDAY AND
PAYMENTID =7
INTO :CHECKSALES;
This is part of the same stored procedure, this is actually
returning zero if there is no matching row in table. Here the table
is different table, but for given salesday there is no record.
And I still didn't initialize the variable
I am confused here.
Regards,
Muthu