Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR ALTER PROCEDURE PRO_ARREDONDAR_NOTA (ANOTA DOUBLE PRECISION)
- RETURNS (RESULT DOUBLE PRECISION)
- AS
- DECLARE VARIABLE DecPart DOUBLE PRECISION;
- BEGIN
- RESULT = 0;
- DecPart = ROUND(ANOTA - TRUNC(ANOTA), 2) * 100;
- IF (DecPart = 50) THEN
- RESULT = ANOTA;
- ELSE
- IF (DecPart < 25) THEN
- RESULT = TRUNC(ANOTA);
- ELSE
- IF ((DecPart >= 25) AND (DecPart < 75)) THEN
- RESULT = TRUNC(ANOTA) + 0.5;
- ELSE
- IF (DecPart >= 75) THEN
- RESULT = TRUNC(ANOTA) + 1;
- SUSPEND;
- END;
Advertisement
Add Comment
Please, Sign In to add comment