Skip site navigation (1) Skip section navigation (2)

parametrized query

From: Ben Kim <bkim(at)coe(dot)tamu(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: parametrized query
Date: 2004-04-28 15:46:54
Message-ID: (view raw or whole thread)
Lists: pgsql-admin
I tried but couldn't find an answer if this is possible in psql.

Create a file named test.sql
	select * from mytable where id = ? (or use $1, $2...)
Then in psql do
	\i test.sql 337

to achieve the same effect "select * from mytable where id=337"

as I would in perl
	$sth = $dbh -> prepare ("insert into mytable values (?, ?, ?)")

Is writing a function the only way? Is there another way that can be done
without writing a function?

Ben Kim


pgsql-admin by date

Next:From: Andreas SchmitzDate: 2004-04-28 16:06:20
Subject: Re: parametrized query
Previous:From: Bruno Wolff IIIDate: 2004-04-28 08:32:23
Subject: Re: [JDBC] [PERFORM] is a good practice to create an index on the

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group