From: | "Dinesh Pandey" <dpandey(at)secf(dot)com> |
---|---|
To: | "'PostgreSQL'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | dynamic 'INSERT' query? |
Date: | 2005-04-14 11:37:54 |
Message-ID: | 20050414114131.C840B53726@svr1.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
How can we set A1, A2 values in dynamic 'INSERT' query?
DECLARE
_record RECORD;
_sql VARCHAR(2000);
FOR _record IN SELECT A1, A2 FROM A
LOOP
_sql := 'INSERT INTO B VALUES (:A1, :A2)';
EXECUTE (_sql);
END LOOP;
=================================================================
I can do this as (but I need another way instead of using || operator).
_sql := 'INSERT INTO B VALUES (' || _record.A1 || ',' || _record.A2 || ')';
=================================================================
Regards
Dinesh Pandey
----------------------------------------------------------------------------
------
Dinesh Pandey
Sr. Software Engineer
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Joseph Krogh | 2005-04-14 11:53:12 | Re: Very low performance on table with only 298 rows |
Previous Message | Richard Huxton | 2005-04-14 11:28:07 | Re: Very low performance on table with only 298 rows |