Re: How to pass parameters into a sql script ?

Поиск
Список
Период
Сортировка
От Vyacheslav Kalinin
Тема Re: How to pass parameters into a sql script ?
Дата
Msg-id 9b1af80e0905280910x248b2467u35f2c063915a8224@mail.gmail.com
обсуждение исходный текст
Ответ на How to pass parameters into a sql script ?  ("Atul Chojar" <achojar@airfacts.com>)
Ответы Re: How to pass parameters into a sql script ?  ("Atul Chojar" <achojar@airfacts.com>)
Список pgsql-admin
Looks like quoting issue.
Try this one:

$ psql -d us_audit -e -1 -v p_date=\'20081023\' -f chk_param.sql
select count(*) from prod_debit_payments_unapplied where when_received = (select :p_date::char(8));

or even

select count(*) from prod_debit_payments_unapplied where when_received = :p_date;

On Thu, May 28, 2009 at 6:57 PM, Atul Chojar <achojar@airfacts.com> wrote:

We are unable to pass parameters into any sql script. Could anyone look at the test below and give any suggestions? PostgreSQL version is 8.2.7, running on Linux.

 

Test Script

========

$ cat chk_param.sql

select ''''||:p_date::char(8)||'''';

select count(*) from prod_debit_payments_unapplied where when_received = (select ''''||:p_date::char(8)||'''');

select count(*) from prod_debit_payments_unapplied where when_received = '20081023';...


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

Предыдущее
От: "Atul Chojar"
Дата:
Сообщение: How to pass parameters into a sql script ?
Следующее
От: Ibrahim Shaame
Дата:
Сообщение: Cannot compile pgadmin3-1.10.0-beta3