Re: Junk queries with variables? - Mailing list pgsql-sql

From KÖPFERL Robert
Subject Re: Junk queries with variables?
Date
Msg-id ED4E30DD9C43D5118DFB00508BBBA76EB165E1@neptun.sonorys.at
Whole thread Raw
In response to Junk queries with variables?  ("Steve - DND" <postgres@digitalnothing.com>)
Responses Re: Junk queries with variables?  ("Steve Valaitis" <steve@digitalnothing.com>)
List pgsql-sql
In pgadmins SQL-window SQL is the 'language' of choice. Or it is rather the
only language. Thus if you intend to program plTk or PL/pgSQL, there's no
way around defining a function.

(At first you have to define a new language in your schema)

C:\> -----Original Message-----
C:\> From: Steve - DND [mailto:postgres@digitalnothing.com]
C:\> Sent: Donnerstag, 24. Februar 2005 07:13
C:\> To: pgsql-sql@postgresql.org
C:\> Subject: [SQL] Junk queries with variables?
C:\> 
C:\> 
C:\> I really have to be missing something here and this 
C:\> probably a *really* noob
C:\> question. I don't have a problem running little junk 
C:\> queries in the pgAdmin
C:\> query window(SELECT blah FROM blah, INSERT INTO blah, 
C:\> etc...), but I can't
C:\> figure out how to run queries with variables outside of a 
C:\> function. I just
C:\> want to use variables without having to go about creating 
C:\> and dropping a
C:\> function for every stupid little query I need to write. Example:
C:\> 
C:\> amount int4 := 1000;
C:\> earliest_date timestamp := current_timestamp;
C:\> 
C:\> SELECT ...
C:\> 
C:\> I always get the error: "ERROR:  syntax error at or near 
C:\> "amount" at
C:\> character 1". What have I done wrong, or am I missing?
C:\> 
C:\> Thanks,
C:\> Steve
C:\> 
C:\> 
C:\> 
C:\> ---------------------------(end of 
C:\> broadcast)---------------------------
C:\> TIP 9: the planner will ignore your desire to choose an 
C:\> index scan if your
C:\>       joining column's datatypes do not match
C:\> 


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Junk queries with variables?
Next
From: T E Schmitz
Date:
Subject: Re: aggregate / group by question