Re: SQL from shell script - Mailing list pgsql-novice

From Geoffrey
Subject Re: SQL from shell script
Date
Msg-id 41E81E60.9080307@3times25.net
Whole thread Raw
In response to Re: SQL from shell script  (sarlav kumar <sarlavk@yahoo.com>)
Responses Re: SQL from shell script
List 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

pgsql-novice by date:

Previous
From: "Schuhmacher, Bret"
Date:
Subject: Re: SQL from shell script
Next
From: Michael Fuhr
Date:
Subject: Re: SQL from shell script