another problem with pgsql and interva/timestamp

Поиск
Список
Период
Сортировка
От Fernando Papa
Тема another problem with pgsql and interva/timestamp
Дата
Msg-id F1DC5B511E2D1C499E5E20FC6D74160D01D6D7B9@exch2000.buehuergo.corp.claxson.com
обсуждение исходный текст
Ответы Re: another problem with pgsql and interva/timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi posgresql gurus!

As you see, I have a LOT of problems with interval and timestamp
types...

Now, I'm trying to add a numer of days to a date.

If I do this:
select now() + interval '2 day'

I get a datetime two days in the future, thats ok. I want to do this,
but I have these "2" into a variable inside pl/pgsql.

And, when I try to do this:
(N_cantidad_dias is numeric, D_Fecha_hasta is date, v_aux is varchar)

N_cant_dias = 2;
v_aux = to_char(N_cantidad_dias,''999'')||'' day'';
D_Fecha_hasta := now()+ vaux::interval;

I get an error: Cannot cast type character varying to interval.

Then, I try in anoter way:

N_cant_dias = 2;
v_aux = to_char(N_cantidad_dias,''999'')||'' day'';
select into D_fecha_hasta now() + ''''v_aux''''::interval

but I get this error messages:
WARNING:  line 110 at select into variables
ERROR:  parser: parse error at or near "$1" at character 20

Really, I cant detect what is wrong here...

Thanks in advance!

--
Fernando O. Papa
DBA

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Posts get losts
Следующее
От: Joseph Shraibman
Дата:
Сообщение: Re: ERROR: out of free buffers: time to abort!