Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id BFE2F9F9EEC for ; Wed, 22 Nov 2006 11:35:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 29815-01 for ; Wed, 22 Nov 2006 11:34:59 -0400 (AST) X-Greylist: delayed 05:40:09.942316 by SQLgrey- Received: from web90504.mail.mud.yahoo.com (web90504.mail.mud.yahoo.com [216.252.100.171]) by postgresql.org (Postfix) with SMTP id 816999F9CF6 for ; Wed, 22 Nov 2006 11:34:59 -0400 (AST) Received: (qmail 26960 invoked by uid 60001); 22 Nov 2006 08:28:16 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0uYvsOCjS1nxe3w6+Et8pguTXvbO2XCzBYY05sdkEMw8I5nNGHgb/kY+CLk0bXAMIsK9ZoVqCY3Y9XGUxFXbpJ3Cy8rr3FNUdRX4hpN/6OuzI1ptoMRa80apg57qmW+eozyeR9rKMTGZLsIjW51aBJvlspYRFIEtFxln9pHzJQE= ; Message-ID: <20061122082816.26958.qmail@web90504.mail.mud.yahoo.com> Received: from [219.95.167.205] by web90504.mail.mud.yahoo.com via HTTP; Wed, 22 Nov 2006 00:28:15 PST Date: Wed, 22 Nov 2006 00:28:15 -0800 (PST) From: Mulham freshcode Subject: select into To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1812017022-1164184095=:22929" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.852 tagged_above=0 required=5 tests=BAYES_00, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_30_40, HTML_MESSAGE, RCVD_IN_NJABL_PROXY X-Spam-Level: * X-Archive-Number: 200611/227 X-Sequence-Number: 26879 --0-1812017022-1164184095=:22929 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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. Thank you, --------------------------------- Sponsored Link Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new house payment --0-1812017022-1164184095=:22929 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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.

   Thank you,


Sponsored Link

Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new house payment --0-1812017022-1164184095=:22929--