From: KÖPFERL Robert <robert.koepferl@sonorys.at>
To: pgsql-sql@postgresql.org
Subject: Re: Junk queries with variables?
Date: Thu, 24 Feb 2005 10:08:48 +0100
Message-ID: <ED4E30DD9C43D5118DFB00508BBBA76EB165E1@neptun.sonorys.at> (raw)
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:\>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: robert.koepferl@sonorys.at
Subject: Re: Junk queries with variables?
In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB165E1@neptun.sonorys.at>
References: <ED4E30DD9C43D5118DFB00508BBBA76EB165E1@neptun.sonorys.at>
* 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