Subject Re: Error with LPAD function
Author yaedos2000
Actually this works fine now, not sure what was wrong with it...

--- In firebird-support@yahoogroups.com, "yaedos2000"
<yaedos2000@y...> wrote:
>
> Hi,
>
> I'm having problems running the UDF function LPAD in a stored
> procedure. I've defined the function as:
>
> DECLARE EXTERNAL FUNCTION LPAD
> CSTRING(255),
> INTEGER,
> CSTRING(1)
> RETURNS CSTRING(255) FREE_IT
> ENTRY_POINT 'IB_UDF_lpad' MODULE_NAME 'IB_UDF'
>
>
> The proceudre itself is defined as follows:
>
> CREATE PROCEDURE SP_TEST_LPAD
> RETURNS (
> OUT_HACID VARCHAR(255))
> AS
> DECLARE VARIABLE VAR_HACID VARCHAR(255);
> begin
> SELECT
> HACID_FROM
> FROM
> TBL_MTRNS
> WHERE
> TRNREF = 'OPEN'
> INTO
> :VAR_HACID;
>
> OUT_HACID = LPAD(VAR_HACID, 255, '[');
>
> suspend;
> end
>
>
> Everything compiles OK, but when try to run the procedure I get the
> error:
>
> "Arithmetic overflow or division by zero has occurred. arithmetic
> exception, numeric overflow, or string truncation."
>
> Any ideas as to what's wrong with the procedure and why it's
> happening?
>
> Thanks
>