Perl and psql variables

Поиск
Список
Период
Сортировка
От Mark Campbell
Тема Perl and psql variables
Дата
Msg-id 444F6360.2000508@ucs.co.za
обсуждение исходный текст
Ответы Re: Perl and psql variables
Re: Perl and psql variables
Список pgsql-novice
Hi

I am currently running a Perl script once a month which in turn uses a
sql script file to extract info from a postgres database.

I would like to automate this perl script, but the problem that I have
is that I need to pass on a variable from the perl script to the sql script.


Yes, I can add the entire block of sql code into the perl script, but I
don't want it to function like that ie duplicate the sql code in the
perl script, as I might need a different perl script to execute the same
sql.

eg

the perl script generates a variable called $month (which is the current
month), I then need that month variable passed as a command line line
parameter to psql. eg psql -f sql.file --variable "month = $month"
then do a SELECT with the variable called :month

Is this possible to do, if so how?

Regards

--

Mark Campbell


Confidentiality Notice: http://ucs.co.za/conf.html


В списке pgsql-novice по дате отправления:

Предыдущее
От: Ennio-Sr
Дата:
Сообщение: Re: How to obtain algebraic sum of equal lines
Следующее
От: Sean Davis
Дата:
Сообщение: Re: Perl and psql variables