[Pgsql-ayuda] ultimo dia del mes

Alvaro Herrera alvherre@dcc.uchile.cl
Mon, 15 Dec 2003 10:12:34 -0300


On Mon, Dec 15, 2003 at 10:46:19AM +0000, GUSTAVO MARTIN OCAMPO wrote:

> pero no logro crearla, el problema que tengo es, a mi entender, cuando 
> quiero escapar con comillas simples, me podrian dar una mano?, ya intente 
> escapar la variable con varias comillas pero no logro crear la funcion..

create or replace function ultimo_dia_mes(date) returns double precision
as 'select extract (day from (select date_trunc(''month'', date($1)) +
interval ''1 month'') - interval ''1 day''); ' language sql;

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Before you were born your parents weren't as boring as they are now. They
got that way paying your bills, cleaning up your room and listening to you
tell them how idealistic you are."  -- Charles J. Sykes' advice to teenagers