Re: script
am 10.11.2005, um 10:10:22 +0100 mailte Maik Tr�mel folgendes:
Hello!
I want to run a shell script with variables under Postgresql.
An example:
I want to make the following query;select * from tablename where id=1;
select * from tablename where id=2;
select * from tablename where id=3;
select * from tablename where id=4;
.........Is it possible to do it this way and what is the right syntax. All i've
tried out didn't work.while i<100 do
select * from tablename where id=i;
i=i+1;
done
for i in `seq 10` ; do
echo "select * from foo where id = $i" | psql test
done;
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
Import Notes
Reply to msg id not found: 43730E7E.6020301@maitro.netReference msg id not found: 43730E7E.6020301@maitro.net
Hello!
How do you get the list of id's? If you get it while some calculating
you may get the list of them (1, 3, 6,...) and then produce the query
select * from tablename where id in (your_list)
Hope this helps,
Nicolay
Maik Tr�mel wrote:
Show quoted text
Hello!
I want to run a shell script with variables under Postgresql.
An example:
I want to make the following query;select * from tablename where id=1;
select * from tablename where id=2;
select * from tablename where id=3;
select * from tablename where id=4;
.........Is it possible to do it this way and what is the right syntax. All i've
tried out didn't work.while i<100 do
select * from tablename where id=i;
i=i+1;
doneThanks for your help.
Greetings
Maik
Import Notes
Reply to msg id not found: 43730E7E.6020301@maitro.netReference msg id not found: 43730E7E.6020301@maitro.net | Resolved by subject fallback