Returning a long string (varchar from a function)

Поиск
Список
Период
Сортировка
От Oisin Glynn
Тема Returning a long string (varchar from a function)
Дата
Msg-id 00a601c50ecd$1d702320$a974fea9@homisco.local
обсуждение исходный текст
Ответ на Re: Finding column using SQL query.  ("Rajan Bhide" <rbhide@starentnetworks.com>)
Ответы Re: Returning a long string (varchar from a function)  (Michael Fuhr <mike@fuhr.org>)
Список 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;



В списке pgsql-novice по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Last ID Problem
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Last ID Problem