Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-12-2017
Avatar de Angel.Matilla
Angel.Matilla Angel.Matilla is offline
Miembro
 
Registrado: ene 2007
Posts: 1.350
Poder: 19
Angel.Matilla Va por buen camino
Cita:
Empezado por Casimiro Notevi Ver Mensaje
¿Has comprobado que son null, no cadena vacía ''?
Lo cierto es que no; he dado por supuesto que se iban a comportar igual. Y es cierto, eran candenas vacías
Responder Con Cita
  #2  
Antiguo 12-12-2017
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.052
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Cita:
Substituting NULL with a value
The COALESCE function

The COALESCE function in Firebird 1.5 and higher can convert NULL to most anything else. This enables you to perform an on-the-fly conversion and use the result in your further processing, without the need for “if (MyExpression is null) then” or similar constructions. The function signature is:

COALESCE( Expr1, Expr2, Expr3, ... )

COALESCE returns the value of the first non-NULL expression in the argument list. If all the expressions are NULL, it returns NULL.
https://www.firebirdsql.org/manual/n...nversions.html
Responder Con Cita
  #3  
Antiguo 12-12-2017
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 30
jhonny Va camino a la famajhonny Va camino a la fama
Debido a lo de la cadena vacía, puedes combinar con NULLIF, así:

Código SQL [-]
SELECT Apellidos, Referencia, Nif, Codigo, COALESCE(NullIf(Referencia, ''), NullIf(Nif, ''), NullIf(CAST(Codigo AS VARCHAR(10), '') ))
FROM Persona
ORDER BY 2,3,4,5
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #4  
Antiguo 12-12-2017
Avatar de Angel.Matilla
Angel.Matilla Angel.Matilla is offline
Miembro
 
Registrado: ene 2007
Posts: 1.350
Poder: 19
Angel.Matilla Va por buen camino
Cita:
Empezado por jhonny Ver Mensaje
Debido a lo de la cadena vacía, puedes combinar con NULLIF
Gracias, no se me había ocurrido.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Coalesce en índice de firebird mightydragonlor Firebird e Interbase 7 26-06-2012 21:29:31
Error en Coalesce de un Parámetro tipo Int64 gluglu Firebird e Interbase 42 17-06-2011 02:47:15
SQL CASE y COALESCE mjjj SQL 1 17-12-2008 16:37:52
Duda sobre COALESCE AGAG4 Firebird e Interbase 4 28-04-2006 21:00:57
Algo sobre COALESCE jwmoreira Firebird e Interbase 1 08-03-2005 20:23:20


La franja horaria es GMT +2. Ahora son las 21:48:59.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi