db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chaa...@apache.org
Subject svn commit: r811109 - in /db/derby/docs/trunk/src/ref: refderby.ditamap rreffunccoalesce.dita
Date Thu, 03 Sep 2009 20:29:43 GMT
Author: chaase3
Date: Thu Sep  3 20:29:43 2009
New Revision: 811109

URL: http://svn.apache.org/viewvc?rev=811109&view=rev
Log:
DERBY-495: COALESCE

Documented COALESCE function in Reference Manual.

Patch: DERBY-495-3.diff

Added:
    db/derby/docs/trunk/src/ref/rreffunccoalesce.dita   (with props)
Modified:
    db/derby/docs/trunk/src/ref/refderby.ditamap

Modified: db/derby/docs/trunk/src/ref/refderby.ditamap
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/refderby.ditamap?rev=811109&r1=811108&r2=811109&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/refderby.ditamap (original)
+++ db/derby/docs/trunk/src/ref/refderby.ditamap Thu Sep  3 20:29:43 2009
@@ -271,6 +271,7 @@
 <topicref href="rrefsqlj33562.dita" navtitle="CAST function"></topicref>
 <topicref href="rreffuncceil.dita" navtitle="CEIL or CEILING function"></topicref>
 <topicref href="rrefbuiltchar.dita" navtitle="CHAR function"></topicref>
+<topicref href="rreffunccoalesce.dita" navtitle="COALESCE function"></topicref>
 <topicref href="rrefsqlj40899.dita" navtitle="Concatenation operator"></topicref>
 <topicref href="rreffunccos.dita" navtitle="COS function"></topicref>
 <topicref href="rreffunccosh.dita" navtitle="COSH function"></topicref>

Added: db/derby/docs/trunk/src/ref/rreffunccoalesce.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rreffunccoalesce.dita?rev=811109&view=auto
==============================================================================
--- db/derby/docs/trunk/src/ref/rreffunccoalesce.dita (added)
+++ db/derby/docs/trunk/src/ref/rreffunccoalesce.dita Thu Sep  3 20:29:43 2009
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at      
+
+http://www.apache.org/licenses/LICENSE-2.0  
+
+Unless required by applicable law or agreed to in writing, software  
+distributed under the License is distributed on an "AS IS" BASIS,  
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+See the License for the specific language governing permissions and  
+limitations under the License.
+-->
+<reference id="rreffunccoalesce" xml:lang="en-us">
+<title>COALESCE function</title>
+<shortdesc>The COALESCE function takes two or more compatible arguments and
+returns the first argument that is not null.</shortdesc>
+<prolog><metadata>
+<keywords><indexterm>COALESCE function</indexterm>
+<indexterm>functions<indexterm>COALESCE</indexterm></indexterm>
+</keywords>
+</metadata></prolog>
+<refbody>
+<section><p>The result is null only if all the arguments are null.</p>
+<p>If all the parameters of the function call are dynamic, an error occurs.</p>
+<note>A synonym for COALESCE is VALUE. VALUE is accepted by
+<ph conref="../conrefs.dita#prod/productshortname"></ph> but is not
+recognized by the SQL standard.</note></section>
+<refsyn><title>Syntax</title>
+<codeblock><b>COALESCE ( <varname>expression</varname>, <varname>expression</varname>
[, <varname>expression</varname>]* )</b></codeblock> 
+<p>The function must have at least two arguments.</p>
+</refsyn>
+<example><title>Example</title>
+<codeblock><b>ij> -- create table with three different integer types
+ij> create table temp(smallintcol smallint, bigintcol bigint, intcol integer);
+0 rows inserted/updated/deleted
+
+ij> insert into temp values (1, null, null);
+1 row inserted/updated/deleted
+ij> insert into temp values (null, 2, null);
+1 row inserted/updated/deleted
+ij> insert into temp values (null, null, 3);
+1 row inserted/updated/deleted
+
+ij> select * from temp;
+SMALL&amp;|BIGINTCOL           |INTCOL     
+---------------------------------------
+1     |NULL                |NULL       
+NULL  |2                   |NULL       
+NULL  |NULL                |3          
+
+3 rows selected
+
+ij> -- the return data type of coalesce is bigint
+ij> select coalesce (smallintcol, bigintcol) from temp;
+1                   
+--------------------
+1                   
+2                   
+NULL                
+
+3 rows selected
+
+ij> -- the return data type of coalesce is bigint
+ij> select coalesce (smallintcol, bigintcol, intcol) from temp;
+1
+--------------------
+1
+2
+3 
+
+3 rows selected
+
+ij> -- the return data type of coalesce is integer
+ij> select coalesce (smallintcol, intcol) from temp;
+1          
+-----------
+1          
+NULL       
+3          
+
+3 rows selected
+</b></codeblock>
+</example>
+</refbody>
+</reference>

Propchange: db/derby/docs/trunk/src/ref/rreffunccoalesce.dita
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message