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

Re: SQL from shell script

From: Geoffrey <esoteric(at)3times25(dot)net>
To: pgsqlnovice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: SQL from shell script
Date: 2005-01-14 19:32:48
Message-ID: 41E81E60.9080307@3times25.net (view raw or flat)
Thread:
Lists: pgsql-novice
sarlav kumar wrote:
> Hi,
> 
> I haven't used PERL or JAVA to do this before. I will look at the
> documentation and try out using perl DBI.
> 
> But is there a way to proceed with the way I started?

You'll have to figure out another way to handle the password, but you 
can pass multiple commands to psql as follows:

echo echo "select * from table1; select * from table2;"|psql rnd

I don't know if there is a limit to the # of commands you can send in 
this manner, but if it's a good many you can make more readable as follows:

echo "select * from table1;
	select * from table2;
	select * from table3;
	"|psql rnd

Still, you'll have to deal with the password a different way likely.

-- 
Until later, Geoffrey

In response to

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2005-01-14 19:57:03
Subject: Re: SQL from shell script
Previous:From: Schuhmacher, BretDate: 2005-01-14 19:26:03
Subject: Re: SQL from shell script

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