X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 658465591B for ; Thu, 24 Feb 2005 06:12:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02717-04 for ; Thu, 24 Feb 2005 06:12:43 +0000 (GMT) Received: from fed1rmmtao11.cox.net (fed1rmmtao11.cox.net [68.230.241.28]) by svr1.postgresql.org (Postfix) with ESMTP id 4950F54CFF for ; Thu, 24 Feb 2005 06:12:42 +0000 (GMT) Received: from dnd2 ([68.2.114.10]) by fed1rmmtao11.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050224061248.MKPB22013.fed1rmmtao11.cox.net@dnd2> for ; Thu, 24 Feb 2005 01:12:48 -0500 From: "Steve - DND" To: Subject: Junk queries with variables? Date: Wed, 23 Feb 2005 23:12:47 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/290 X-Sequence-Number: 20400 I really have to be missing something here and this probably a *really* noob question. I don't have a problem running little junk queries in the pgAdmin query window(SELECT blah FROM blah, INSERT INTO blah, etc...), but I can't figure out how to run queries with variables outside of a function. I just want to use variables without having to go about creating and dropping a function for every stupid little query I need to write. Example: amount int4 := 1000; earliest_date timestamp := current_timestamp; SELECT ... I always get the error: "ERROR: syntax error at or near "amount" at character 1". What have I done wrong, or am I missing? Thanks, Steve