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) SELECT media.media_id,
media.media_type WHERE media.media_id IN
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 history
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)
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