alvherre(at)dcc(dot)uchile(dot)cl (Alvaro Herrera) wrote in message
> Certainly. Try the following:
> SELECT now() + 5 * '1 day'::interval;
>
> Or, more verbose,
> SELECT now() + 5 * CAST('1 day' AS interval);
>
> You can of course do
> SELECT now() + CAST('5 day' AS interval);
>
> But the two previous examples can be more easily constructed in an SQL or
> PL/pgSQL function.
Perhaps I should get myself a copy of the relevant parts of the SQL 99 standard.
How would you do the above in standard SQL?
> For the date -I format you can use something like
> SELECT to_char(now() + 5 * '1 day'::interval, 'YYYY-MM-DD');
I believe Oracle also has a to_char() function. Is this to_char() function
part of standard SQL or is it just a coincidence that both DBMSs support
such a function call? I wonder whether the PostgreSQL to_char()
function is compatible with the Oracle one.
Thanks,
Neil