Subject CAST(var1 AS NUMERIC(18,:variable));
Author Luis Madaleno
Hi,

I need to use the CAST() function to emulate a ROUND, but the decimal
places I want are not fix, they are based on a field value.
So I thought I could do this:

CREATE PROCEDURE MYPROC(VALUE NUMERIC(18,6)) RETURNS RESULT NUMERIC(18,6);
AS
DECLARE VARIABLE DECIMAL_PLACES INTEGER;
BEGIN
SELECT DECIMAL_PLACES FROM MYTABLE INTO :DECIMAL_PLACES;
RESULT = CAST(VALUE AS NUMERIC(18, DECIMAL_PLACES));
END;

This is not the real SP, is just to demonstrate my need.
Is it possible to use the CAST in this way? Or can I achieve what I need
in any way?

Regards,

Luis Madaleno


[Non-text portions of this message have been removed]