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:\>