RE: Comprobar que un numeric tenga decimales.

From: arturo garcia <josearturogarcia(at)hotmail(dot)com>
To: <listapostgres(at)hotmail(dot)com>, <guerrero(dot)beto(at)gmail(dot)com>, <conrado(at)mapfre(dot)com(dot)ar>
Cc: <systemguards(at)gmail(dot)com>, <randradefonseca(at)gmail(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: Comprobar que un numeric tenga decimales.
Date: 2006-10-13 14:50:51
Message-ID: BAY124-W18ABC8225CC3F55A83748ACC0A0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Cual de las soluciones aplicaste???

> From: listapostgres(at)hotmail(dot)com> To: guerrero(dot)beto(at)gmail(dot)com; conrado(at)mapfre(dot)com(dot)ar> CC: systemguards(at)gmail(dot)com; randradefonseca(at)gmail(dot)com; pgsql-es-ayuda(at)postgresql(dot)org> Subject: Re: [pgsql-es-ayuda] Comprobar que un numeric tenga decimales.> Date: Mon, 9 Oct 2006 21:08:33 +0000> > Gracias a todos por responder.> Lo primero es que estoy trabajando con plpgsql, y lo segundo ya solucione > con lo que me recomendaron de verificar si el valor es igual al truncado, > con eso ya puedo seguir realizando mis verificaciones.> > Gracias a todos. :)> Zule.> > > >From: "Beto Guerrero" <guerrero(dot)beto(at)gmail(dot)com>> >To: "conrado(at)mapfre(dot)com(dot)ar" <conrado(at)mapfre(dot)com(dot)ar>> >CC: listapostgres(at)hotmail(dot)com, systemguards(at)gmail(dot)com, > >pgsql-es-ayuda(at)postgresql(dot)org> >Subject: Re: [pgsql-es-ayuda] Comprobar que un numeric tenga decimales.> >Date: Mon, 9 Oct 2006 15:37:46 -0500> >> >podrias usar algo asi:> >> >select case when position('.' in campo)=0 then 'No' else 'Si' end as> >decimal from tabla> >> >El 9/10/06, conrado(at)mapfre(dot)com(dot)ar<conrado(at)mapfre(dot)com(dot)ar> escribió:> >>Podrías verificar el resultado de la condicion.> >>> >>si tu_valor = trunc(tu_valor) entonces> >> sin decimales> >>sino> >> con decimales> >>> >>> >> > -----Mensaje original-----> >> > De: listapostgres(at)hotmail(dot)com [mailto:listapostgres(at)hotmail(dot)com]> >> > Enviado el: Lunes, 09 de Octubre de 2006 05:23 p.m.> >> > Para: systemguards(at)gmail(dot)com> >> > CC: pgsql-es-ayuda(at)postgresql(dot)org> >> > Asunto: Re: [pgsql-es-ayuda] Comprobar que un numeric tenga decimales.> >> >> >> >> >> > Gracias por responder, pero esas funciones solo me permiten> >> > obtener un> >> > valor, me explico, yo necesito saber si el resultado de una operacion> >> > resulta decimal o no.> >> > Por ejemplo:> >> >> >> > result numeric;> >> > oper1 numeric;> >> > oper2 numeric;> >> >> >> > result = oper1 + oper2;> >> >> >> > 1 + 1 = 2 ----> Valor entero> >> > 1.5 + 1 = 2.5 -----> Valor Decimal> >> >> >> > Y el resultado se almacena en la misma variable> >> >> >> > Ahora bien, como saber si el resultado contiene decimales, o> >> > si la parte> >> > decimal es "0"?> >> >> >> > Gracias, espero haberme explicado mejor. :)> >> > Zule> >> >> >> >> >> >> >> > >From: "Jaime Casanova" <systemguards(at)gmail(dot)com>> >> > >To: "listapostgres(at)hotmail(dot)com" <listapostgres(at)hotmail(dot)com>> >> > >CC: pgsql-es-ayuda(at)postgresql(dot)org> >> > >Subject: Re: [pgsql-es-ayuda] Comprobar que un numeric tenga> >> > decimales.> >> > >Date: Mon, 9 Oct 2006 15:13:48 -0500> >> > >> >> > >On 10/9/06, listapostgres(at)hotmail(dot)com> >> > <listapostgres(at)hotmail(dot)com> wrote:> >> > >>Hola lista!> >> > >>> >> > >>Como podria saber si un dato de tipo numeric posee decimales?> >> > >>La razon es la siguiente, yo realizo un calculo en donde el> >> > resultado> >> > >>algunas veces podria resultar con decimales, pero en otras> >> > ocasiones el> >> > >>resultado es entero (esto es porque en una tabla existen datos con> >> > >>decimales> >> > >>y otros sin ello, lo que al sumar un entero con un entero> >> > me resulta un> >> > >>entero, pero al sumar un decimal con un entero u otro> >> > decimal resulta un> >> > >>decimal).> >> > >>> >> > >> >> > >puedes usar una de las funciones siguentes segun te convenga:> >> > >> >> > >- ceil(numeric)> >> > >- floor(numeric)> >> > >- round(numeric)> >> > >- trunc(numeric)> >> > >> >> > >http://www.postgresql.org/docs/8.1/static/functions-math.html> >> > >> >> > >--> >> > >Atentamente,> >> > >Jaime Casanova> >> > >> >> > >"Programming today is a race between software engineers striving to> >> > >build bigger and better idiot-proof programs and the universe trying> >> > >to produce bigger and better idiots.> >> > >So far, the universe is winning."> >> > > Richard Cook> >> > >> >> > >---------------------------(fin del> >> > mensaje)---------------------------> >> > >TIP 7: no olvides aumentar la configuración del "free space map"> >> >> >> > _________________________________________________________________> >> > Un amor, una aventura, compañía para un viaje. Regístrate> >> > gratis en MSN Amor> >> > & Amistad. http://match.msn.es/match/mt.cfm?pg=channel&tcid=162349> >> >> >> >> >> > ---------------------------(fin del> >> > mensaje)---------------------------> >> > TIP 4: No hagas 'kill -9' a postmaster> >> >> >>> >>---------------------------(fin del mensaje)---------------------------> >>TIP 5: ¿Has leído nuestro extenso FAQ?> >>> >> http://www.postgresql.org/files/documentation/faqs/FAQ.html> >>> >> >> >--> >> >Atte> >> >Alberto Nicolas Guerrero P.> >Desarrollador Java / Open Source> >Tel: +51.15331720> >Cel: +51.197208984> >> >---------------------------(fin del mensaje)---------------------------> >TIP 3: si publicas/lees desde Usenet, por favor envía "subscribe-nomail"> > a majordomo(at)postgresql(dot)org para que tus mensajes puedan llegar> > a los suscriptores de la lista> > _________________________________________________________________> Grandes éxitos, superhéroes, imitaciones, cine y TV... > http://es.msn.kiwee.com/ Lo mejor para tu móvil.> > > ---------------------------(fin del mensaje)---------------------------> TIP 7: no olvides aumentar la configuración del "free space map"
_________________________________________________________________
Express yourself: design your homepage the way you want it with Live.com.
http://www.live.com/getstarted

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message jsaav 2006-10-13 15:21:13 RE: Re-instalacion de SO WXP- no arranca postmaster
Previous Message arturo garcia 2006-10-13 14:42:48 RE: introducción a postgresql