From: | "Oisin Glynn" <me(at)oisinglynn(dot)com> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Returning a long string (varchar from a function) |
Date: | 2005-02-09 17:30:51 |
Message-ID: | 00a601c50ecd$1d702320$a974fea9@homisco.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I have a function that I am using to provide results back to a program.
I want/need to pass a long string approx. 400chars back from this.
I am getting cut off at 256...
Any way around this. I would be greatful for any help. Below is a dummy
function showing the error.It should return a long list of 'aaaaaa'with the
number of a's appended to the end.
select * from zfunc_test(7);
'aaaaaaa7'
select * from zfunc_test(254);
Gets chopped off to '...aaaa25'
-- Function: zfunc_test(int4)
-- DROP FUNCTION zfunc_test(int4);
CREATE OR REPLACE FUNCTION zfunc_test(int4)
RETURNS "varchar" AS
$BODY$DECLARE
v_length integer;
v_retval varchar;
v_counter integer;
BEGIN
v_length = $1;
v_counter =0;
v_retval :='';
WHILE v_counter < v_length LOOP
v_retval := v_retval || 'a';
v_counter:=v_counter +1;
END LOOP;
v_retval :=v_retval || CAST(v_length as VARCHAR);
return v_retval;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION zfunc_test(int4) OWNER TO postgres;
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-02-09 17:38:28 | Re: Last ID Problem |
Previous Message | operationsengineer1 | 2005-02-09 16:53:18 | Re: Last ID Problem |