Re: user input during runtime

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Ashish Karalkar <ashish(dot)karalkar(at)info-spectrum(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: user input during runtime
Date: 2007-02-17 01:23:48
Message-ID: 200702170123.l1H1Nmd03866@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ashish Karalkar wrote:
> Hello All,
> I want to prompt user to input some value and do some action on that value in runtime of a sql script.
> Is there any psql command to do this ??
> I can use \echo do display massage
> but to take input what is the command?
> Thanks in advance

You can do:

\echo -n 'Enter value: '
\set x `read && echo $REPLY`

in psql. I think we will have \prompt in 8.3.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2007-02-17 01:44:40 Re: Priorities for users or queries?
Previous Message Ron Johnson 2007-02-17 00:42:29 Re: values from now() in the same transaction