Re: Problema con funcion (fecha)

From: Daniel Alvarado <danielal2(at)yahoo(dot)com>
To: dkuroki(at)dbas(dot)com(dot)ar, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Problema con funcion (fecha)
Date: 2005-05-30 21:22:43
Message-ID: 20050530212243.44892.qmail@web20127.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Ya funciono.
No conocia la funcion quote_literal.
Gracias Dorian.
Saludos...

--- dkuroki(at)dbas(dot)com(dot)ar wrote:
>
> Daniel,
>
> Proba usando la funcion quote_literal.
>
> Es decir, la sentencia where quedaria de la sig.
> forma:
> where sl_jefe_empleados.idjefe = \' || _idjefe || \'
> and fecha = \' || quote_literal(_fecha) || \'
>
>
> Dorian Kuroki.
> DBAS
>
> On 5/30/2005, "Daniel Alvarado"
> <danielal2(at)yahoo(dot)com> wrote:
>
> >Que tal lista.
> >Tengo la siguiente funcion. Me regresa error en la
> >sentencia and fecha = \' || _fecha || \'.
> >Alguien sabe como puedo solucionarlo???
> >
> >CREATE OR REPLACE FUNCTION mifuncion(int4,
> timestamp)
> > RETURNS SETOF ty_resumen AS
> >'
> >DECLARE
> > _idjefe ALIAS FOR $1;
> > _fecha ALIAS FOR $2;
> > Myrc ty_resumen%ROWTYPE;
> >BEGIN
> > FOR Myrc IN EXECUTE
> > \'
> > select sl_estadodecuentaindividual.idjefe,
> >sl_grupotarifa.idgrupotarifa,
> >sl_grupotarifa.grupotarifa,
> > sum(costo), sum(llamadas), sum(duracion),
> >sl_estadodecuentaindividual.periodo
> > from sl_estadodecuentaindividual
> > join sl_Tarifas on
> >(sl_estadodecuentaindividual.idtarifa =
> >sl_Tarifas.idtarifa)
> > join sl_jefe_empleados on
> >(sl_estadodecuentaindividual.idempleado =
> >sl_jefe_empleados.idempleado)
> > join sl_grupotarifa on (sl_Tarifas.idgrupotarifa =
> >sl_grupotarifa.idgrupotarifa)
> > where sl_jefe_empleados.idjefe = \' || _idjefe ||
> \'
> > and fecha = \' || _fecha || \'
> > group by sl_estadodecuentaindividual.idjefe,
> >sl_grupotarifa.idgrupotarifa,
> >sl_grupotarifa.grupotarifa,
> >sl_estadodecuentaindividual.fecha
> >;\'
> > LOOP
> > RETURN NEXT Myrc;
> > END LOOP;
> >RETURN ;
> >END;'
> > LANGUAGE 'plpgsql' VOLATILE;
> >
> >Cuando ejecuto la funcion
> >select * from mifuncion(13694,'5/1/2005')
> >Me regresa este error.
> >WARNING: Error occurred while executing PL/pgSQL
> >function mifuncion
> >WARNING: line 7 at for over execute statement
> >
> >ERROR: parser: parse error at or near "00" at
> >character 557
> >
> >
> >SALUDOS.
> >Daniel Alvarado S.
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Small Business - Try our new Resources site
> >http://smallbusiness.yahoo.com/resources/
>
> ---------------------------(fin del
> mensaje)---------------------------
> TIP 5: Has ledo nuestro extenso FAQ?
>
>
>
http://www.postgresql.org/files/documentation/faqs/FAQ.html
>


__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2005-05-30 21:45:35 Re: Postgresql en el Inicio y puerto 5432
Previous Message Jairo Martín Miguel 2005-05-30 21:15:21 Re: ejecutar una consulta creada