Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Adam O'Toole
I solved it. The statment worked as is, I just had to use dynamic SQL (put the statement in a string and the EXECUTE the string). Here is what I did: CREATE FUNCTION test(varchar) RETURNS int2 AS' DECLARE id_list ALIAS FOR $1; query varchar; BEGIN query := '' INSERT INTO history (media_id

Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Tino Wildenhain
Am Dienstag, den 12.07.2005, 12:47 -0300 schrieb Adam O'Toole: > I am trying to INSERT multiple rows to a table using a stored procedure > something like this: > > CREATE FUNCTION test(varchar) RETURNS int2 AS ' > DECLARE > id_list ALIAS FOR $1; > BEGIN > INSERT INTO history (media_id, media_type

Re: [GENERAL] INSERT INTO from a SELECT query

2005-07-13 Thread Gnanavel S
Here the media_id will be  checked with  ('24,25') and not with  (24,25). You might change the datatype from varchar to int array in test function and use "any" in the place of "IN" clause like this, CREATE FUNCTION test(int[]) RETURNS int2 AS ' DECLARE id_list ALIAS FOR $1; BEGIN INSERT INTO h