Sim,
I have given a 'when not found raise exception '
yeah it says no matching records
but the records are there which matches 2 and 3
SampleDB=# select sys_id from subsystems where sys_id = 2 or sys_id =3; sys_id 2 3 2 3(4 rows)
there is a probs with array indexing
I would guess that the cursor is not finding any records.
use notify in the code to see what what values it is finding.
see section 35.9 in the help for how to do this.
put a notify statement on each line that assigns a relevant value and
see what it is.
You can also do a notify on the array to see
Sim,
yeah , after inserting a exit when not found , it is not looping indefinitely, but the function is supposed to return an array as per the declaration , like I am calling the function with an array
select * from getmatch(array[2]);
and I am selecting the records into the cursor which matches t
Sim,
Thanks for your help !
I changed the array_append(array,val) into select array_append(array,val),
when I ran the function it says
SampleDB=# select getmatch(array[2]);ERROR: SELECT query has no destination for result dataHINT: If you want to discard the results, use PERFORM instead.
tri
I suppose you will want to use perform array_append(array,val) instead
of select. That is the plpgsql way to do it. Must have slipped my
mind. PostGresql has 2 different ways of doing the same thing
depending on where you are.
Using regular sql if you don't want to return any result you do a
select
Vidya,
Array_append is a function and is called - select
array_append(array,val).
You left out the select.
Sim
"Vidya" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]...
Hi
I have the following functions , the functions are created but when it is
invoked it errors
For the second function you called select getmatch
without specifying the columns you want.
try select * from getmatch()
"Vidya" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]...
Hi
I have the following functions , the functions are created but when it is
invoked it e
Hi
I have the following functions , the functions are created but when it is invoked it errors out /
SampleDB=# create or replace function getmatch(anyarray) returns anyarray as $$SampleDB$# declareSampleDB$# sys_cursor cursor(key integer) is select sys_id from