pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <akretschmer@spamfence.net>
To: pgsql-sql@postgresql.org
Subject: Re: select into
Date: Wed, 22 Nov 2006 17:07:33 +0100
Message-ID: <20061122160733.GA29180@KanotixBox> (raw)
In-Reply-To: <430473.67117.qm@web31802.mail.mud.yahoo.com>
References: <20061122082816.26958.qmail@web90504.mail.mud.yahoo.com>
	<430473.67117.qm@web31802.mail.mud.yahoo.com>

Richard Broersma Jr <rabroersma@yahoo.com> 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 <table>" 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°



view thread (43+ messages)  latest in thread

Message-ID: <20061122160733.GA29180@KanotixBox>
Permalink:  ../20061122160733.GA29180@KanotixBox/
Also on:    postgresql.org/message-id/20061122160733.GA29180@KanotixBox

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: akretschmer@spamfence.net
  Subject: Re: select into
  In-Reply-To: <20061122160733.GA29180@KanotixBox>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox