Hey All,
I am trying one stored procedure as follows.
CREATE OR REPLACE FUNCTION "public"."get_fees" (VARCHAR(5000)) RETURNS text[] AS
$body$
DECLARE
student_ids ALIAS FOR $1;
studetFee text[];
BEGIN
FOR studetFee IN
SELECT * FROM Student_fee WHERE student_id IN ( student_ids::VARCHAR(5000) )
LOOP
**** some ***
END LOOP;
END;
$body$
It shows me following error when i am trying this query
SELECT * FROM get_fees( '1,2,3,4,5'::VARCHAR(5000) );
ERROR: operator does not exist: dom_id = character varying at character 65
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
What might be the issue.
Thanks Rahul
From stackoverflow
-
You can't do "where student_id in (varchar)" You have to parse the string into a list.
-
Try..
...WHERE student_id = any(( string_to_array(student_ids,',') )http://www.postgresql.org/docs/8.4/static/functions-array.html
Rahul Waghmare : Hey Thanks :) it works for me.rfusca : Can you accept the answer? -
studetFee must be a record type
0 comments:
Post a Comment