Re: Passing Parameters To Command Scripts

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Duncan Garland <duncan(dot)garland(at)ntlworld(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Passing Parameters To Command Scripts
Date: 2006-11-15 15:24:57
Message-ID: 327337.5819.qm@web31810.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> I'm in the process of converting some Oracle SQL scripts to Postgres. Many
> of the scripts accept arguments along the following
> lines:
>
> @tmp.sql fred
>
> I can't find the Postgres equivalent.
>
> This works from outside Postgres:
>
> psql -f tmp.sql -v arg1=fred
>
> This works from within psql
>
> \set arg1 fred
> \i tmp.sql
> \unset arg1
>
> But the following all fail
>
> \i tmp.sql fred
> \i tmp.sql arg1=fred
> \i tmp.sql -v arg1=fred
>
> Can anyone help? What is the correct syntax?

I would be enterested in see a way to pass arguements to a sql script as well. However this link
might help to you do what you want:
http://www.postgresql.org/docs/8.1/interactive/xfunc-sql.html

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message jorge alberto 2006-11-15 21:23:25 can i install and run two diferent versions of postgresql
Previous Message Duncan Garland 2006-11-15 14:56:23 Passing Parameters To Command Scripts