🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11275

Re: Percentage in Stored Procedure

#11275
From: Martijn Tonies
Date: Mon, 02 Dec 2002 12:36
36 lines
1852 bytes
Hi,

> 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;

My guess is that this will work:

UserSyllabusProgress = (cast(:TopicsCompleted as double precision)/
cast(:TopicCount as double precision)) * 100;

btw - you don't need the ":" here - these are only needed in an SQL statement.


--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."
Technical Details
Message-ID: <3deb534f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <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 04:39:04 PST
From: "Martijn Tonies" <m.tonies@upscene_remove.com>
Newsgroups: borland.public.interbase.sql
References: <3deb500b$1@newsgroups.borland.com>
Subject: Re: Percentage in Stored Procedure
Date: Mon, 2 Dec 2002 13:36:58 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 212.238.179.102
Message-ID: <3deb534f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038832463 212.238.179.102 (2 Dec 2002 04:34:23 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail