Re: Junk queries with variables?

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Junk queries with variables?
Date: 2005-02-24 09:08:48
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB165E1@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)digitalnothing(dot)com]
C:\> Sent: Donnerstag, 24. Februar 2005 07:13
C:\> To: pgsql-sql(at)postgresql(dot)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:\>

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2005-02-24 10:34:43 Re: aggregate / group by question
Previous Message Richard Huxton 2005-02-24 08:23:39 Re: Junk queries with variables?