Article View: borland.public.interbase.sql
Article #11277Re: Percentage in Stored Procedure
From: Arno Brinkman
Date: Mon, 02 Dec 2002 12:38
Date: Mon, 02 Dec 2002 12:38
26 lines
1612 bytes
1612 bytes
Hi, > Can anyone help? > > I need to work out a score as a percentage within a stored procedure, I am > using the following code but it doesn't seem to work. > > (TOPICCOUNT integer, > TOPICSCOMPLETED integer, > USERSYLLABUSPROGRESS integer) > > ..... > UserSyllabusProgress = (:TopicsCompleted / :TopicCount) * 100; > ..... > > Thanks in advance, What doesn't seem to work ? TopicsCompleted and TopicCount are integers. This means the result of (:TopicsCompleted / :TopicCount) is also an integer. Give this example a try : UserSyllabusProgress = (CAST(:TopicsCompleted AS NUMERIC(10,2)) / :TopicCount) * 100; Regards, Arno
Technical Details
Message-ID:
<3deb546e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3deb500b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,a766b6afb0ff7831 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-02 05:06:09 PST From: "Arno Brinkman" <_firebird@abvisie.nl_> Newsgroups: borland.public.interbase.sql References: <3deb500b$1@newsgroups.borland.com> Subject: Re: Percentage in Stored Procedure Date: Mon, 2 Dec 2002 13:38:11 +0100 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 213.116.148.11 Message-ID: <3deb546e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038832750 213.116.148.11 (2 Dec 2002 04:39:10 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail