Subject | Re: [firebird-support] Problem Using MOD |
---|---|
Author | Mahesh Ishwar |
Post date | 2003-07-19T06:23:46Z |
Yeah !
It was the declaration that was the problem. I've corrected the declaration and now it is givin' me correct output.
Anyway, just change in declaration can't just shut down the server, or should it? It did almost every time I tried to calculate with that wrong declaration.
Thanx, for the clearification Helen.
Meghansh.
Helen Borrie <helebor@...> wrote:
At 03:54 PM 18/07/2003 +0000, you wrote:
type of the return value by altering the declaration.
Use the declarations in the ib_udf.sql script that should be in your /UDF
directory. In case the script is missing from your installation, here's
the declaration for MOD:
*****************************************/
DECLARE EXTERNAL FUNCTION mod
INTEGER, INTEGER
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_mod' MODULE_NAME 'ib_udf';
/*****************************************
If you want to get an integer rather than a double, use CAST, e.g.
SELECT CAST (MOD(2000,19) AS INTEGER) AS A
FROM RDB$DATABASE;
heLen
Yahoo! Groups SponsorADVERTISEMENT
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Yahoo! Plus - For a better Internet experience
[Non-text portions of this message have been removed]
It was the declaration that was the problem. I've corrected the declaration and now it is givin' me correct output.
Anyway, just change in declaration can't just shut down the server, or should it? It did almost every time I tried to calculate with that wrong declaration.
Thanx, for the clearification Helen.
Meghansh.
Helen Borrie <helebor@...> wrote:
At 03:54 PM 18/07/2003 +0000, you wrote:
>Hi All,As Ivan pointed out, your declaration is wrong. You can't change the data
>
>I'm using the function MOD in a stored procedure in Firebird 1.5 to
>get the remainder of a division but the operation get the wrong
>result.
>
>For Example
>A = MOD(2000, 19);
>The result is 105 instead of 5.
>
>I don't know why is this happen. Somebody could help me???
>
>This is the UDF function
>
>DECLARE EXTERNAL FUNCTION MOD
> INTEGER,
> INTEGER
> RETURNS INTEGER
> ENTRY_POINT 'IB_UDF_mod' MODULE_NAME 'ib_udf';
type of the return value by altering the declaration.
Use the declarations in the ib_udf.sql script that should be in your /UDF
directory. In case the script is missing from your installation, here's
the declaration for MOD:
*****************************************/
DECLARE EXTERNAL FUNCTION mod
INTEGER, INTEGER
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_mod' MODULE_NAME 'ib_udf';
/*****************************************
If you want to get an integer rather than a double, use CAST, e.g.
SELECT CAST (MOD(2000,19) AS INTEGER) AS A
FROM RDB$DATABASE;
heLen
Yahoo! Groups SponsorADVERTISEMENT
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Yahoo! Plus - For a better Internet experience
[Non-text portions of this message have been removed]