Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id EB2F69F9EEC for ; Wed, 22 Nov 2006 12:07:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 90499-08 for ; Wed, 22 Nov 2006 12:07:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from 137086.vserver.de (vs137086.vserver.de [62.75.137.86]) by postgresql.org (Postfix) with ESMTP id F23FB9F9CF9 for ; Wed, 22 Nov 2006 12:07:14 -0400 (AST) Received: from a-kretschmer.de (p54B3C8D3.dip0.t-ipconnect.de [84.179.200.211]) (authenticated bits=0) by 137086.vserver.de (8.12.8/8.12.8) with ESMTP id kAMG73ZR014168 for ; Wed, 22 Nov 2006 17:07:06 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.61) (envelope-from ) id 1GmudJ-0007oT-B9 for pgsql-sql@postgresql.org; Wed, 22 Nov 2006 17:07:33 +0100 Date: Wed, 22 Nov 2006 17:07:33 +0100 From: Andreas Kretschmer To: pgsql-sql@postgresql.org Subject: Re: select into Message-ID: <20061122160733.GA29180@KanotixBox> References: <20061122082816.26958.qmail@web90504.mail.mud.yahoo.com> <430473.67117.qm@web31802.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <430473.67117.qm@web31802.mail.mud.yahoo.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: mutt-ng 1.5.9i (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/230 X-Sequence-Number: 26882 Richard Broersma Jr schrieb: > > Hi guys, > > > > Am new to sql scripting so this might be a stupid question. Am getting an error while trying > > to do the following > > > > SELECT INTO svc_data_rec * from svc_tbl_name where 'uid' = sub_id; > > > > where svc_data_rec is defined as record and svc_tbl_name is a varchar that holds the name of a > > table and sub_id is another varchar. the error message is > > > > ERROR: syntax error at or near "$1" at character 17 > > QUERY: SELECT * from $1 where 'uid' = $2 > > CONTEXT: PL/pgSQL function "foo" line 132 at select into variables > > LINE 1: SELECT * from $1 where 'uid' = $2 > > > > where am i going wrong? it seems that the variables are not being substituted with their > > values correctly. > > Notice: > http://www.postgresql.org/docs/8.2/interactive/sql-selectinto.html > and particularly this example: > http://www.postgresql.org/docs/8.2/interactive/sql-selectinto.html#AEN54014 > Regards, Richard, the plain SQL "INSERT INTO " is an other thing as the original problem... He is in a PL/pgsql - function and he should rewrite this to use EXECUTE ... INTO Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknow) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°