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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-01-14 19:57:03 Re: SQL from shell script
Previous Message Schuhmacher, Bret 2005-01-14 19:26:03 Re: SQL from shell script