Re: Error when using array variable
От | Gnanavel S |
---|---|
Тема | Re: Error when using array variable |
Дата | |
Msg-id | eec3b03c050722023774783b91@mail.gmail.com обсуждение исходный текст |
Ответ на | Error when using array variable ("Dongsoo Yoon" <dsyoon@metasoftworks.com>) |
Ответы |
Re: Error when using array variable
|
Список | pgsql-sql |
On 7/22/05, Dongsoo Yoon <dsyoon@metasoftworks.com> wrote:
You need to initialse the array, Otherwise any value added to the array will be null.
I use a function using array variable as following.The function returns array type.When array variable is allocated with any value,
allocating is not done.I can't find why it is.-------------------------------------------------------CREATE OR REPLACE FUNCTION arr_test()RETURNS NUMERIC[] AS $BODY$DECLAREv_count NUMERIC default 0;v_dayIndex NUMERIC default 0;t_modifiedTimes NUMERIC[];v_testval NUMERIC default 0;....BEGIN....for v_count in 1..5 loopv_dayIndex := v_dayIndex + 1;
t_modifiedTimes[v_dayIndex ] := v_count;
You need to initialse the array, Otherwise any value added to the array will be null.
v_testval := t_modifiedTimes[v_dayIndex ] ; -------------->배열에 저장된 값 임시저장raise exception '임의에러생성 t_modifiedTimes[v_dayIndex ]=', v_testval ;-------------->강제적으로 exception 발생시킴end loop;....return t_modifiedTimes;END;
$BODY$ LANGUAGE plpgsql;
--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.
В списке pgsql-sql по дате отправления: