Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,730
    Member #
    819
    Liked
    201 times
    I was recently asked a question by a friend using Borland Interbase on how to do a COALESCE().

    COALESCE is an ANSI SQL function that returns the first non-null value in a sequence. For instance, COALESCE(null, null, null, 1, null, 2) would return 1
    Well, we went through every function I could muster, and none of them worked:
    1. COALESCE() - the ANSI standard
    2. ISNULL() - the Microsoft T-SQL standard (only takes two values)
    3. IFNULL() - the MySQL standard (only takes two values)
    4. NVL() - Oracle / Informix PL/SQL standard (only takes two values)


    It seems there are databases without inate COALESCE() support. for those databases, it's best to use the following type of query:
    Code:
    SELECT
        (CASE WHEN column IS NULL THEN 'Alternate Value' ELSE column END) AS column
    FROM
        table
    We tried this out, and it worked well. Hope it helps someone !!

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

coalesce alternative
,

coalesce informix

,

informix coalesce

,
interbase coalesce
,
interbase isnull
,
isnull sql interbase
,
oracle nvl alternative
,
plsql nvl alternative
,

tsql ifnull

,
tsql nvl
Click on a term to search for related topics.
All times are GMT -6. The time now is 08:49 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com