Subject Re: [firebird-support] Value check that I don't now how to solve
Author Markus Ostenried
At 16:48 Sunday, 30.11.2003 +0100, you wrote:
>I woul'd do it with a trigger (befor insert, befor edit) and the UDF MOD:
>IF NUMBER * 100 MOD 25 <> 0 -> raise an exception

for the integer operation modulus you don't need an udf.
I once found this useful stored procedure:

<code>
CREATE PROCEDURE PROC_MODULUS( DIVIDEND INTEGER
, DIVISOR INTEGER )
RETURNS ( RESULT INTEGER )
AS
BEGIN
/* this procedure calculates the modulus of two numbers */
IF (Dividend = 0) THEN
Result = 0;
ELSE
Result = Dividend-(CAST((Dividend / Divisor)-0.49 AS INTEGER)*Divisor);
END
</code>

HTH,
Markus