Subject Re: {Disarmed} Re: {Disarmed} Re: [firebird-support] How do I figure what percentage one value is of another value inside a stored procedure?
Author SoftTech
Thanks Marco and Iwan for your help. That did the trick

Mike

----- Original Message -----
From: Iwan Cahyadi Sugeng
To: firebird-support@yahoogroups.com
Sent: Thursday, August 04, 2011 11:12 AM
Subject: {Disarmed} Re: {Disarmed} Re: [firebird-support] How do I figure what percentage one value is of another value inside a stored procedure?



Try this, i think this is what he meant:

SELECT CS.ACCT_ID,
CS.CASE_ID,
CSD.ITEM_DESC,
CSD.ORIG_BAL_DUE,
CSD.SETTLEMENT_AMOUNT,
Case when CSD.ORIG_BAL_DUE > 0 then CSD.SETTLEMENT_AMOUNT /
CSD.ORIG_BAL_DUE else 0 end * 100.00 AS PERCENTAGE
FROM CASE_SETTLEMENT_DETAIL CSD
JOIN CASE_SETTLEMENT CS ON CS.SETTLEMENT_ID = CSD.SETTLEMENT_ID
AND CS.SETTLEMENT_SEQ_NO = CSD.SETTLEMENT_SEQ_NO
WHERE CS.ACCT_ID = :ACCT_ID
AND CS.CASE_ID = :CASE_ID
AND CS.STATUS_CODE = 'A'
ORDER BY CSD.SEQ_NO

On Thu, Aug 4, 2011 at 10:45 PM, SoftTech <miket@...> wrote:

> **
>
>
> Greeting Marco,
>
> I think you may be right on the division by zero. Not sure what you mean by
>
> "use CASE to check before division".
>
> Could you please elaborate.
>
> Thanks,
> Mike
>
> --
Iwan Cahyadi Sugeng

[Non-text portions of this message have been removed]




--
MailScanner Virus/Spam/Malware: PASS (GZ)

[Non-text portions of this message have been removed]