[teiid-issues] [JBoss JIRA] (TEIID-2188) When using CONCAT2(x, y), can the source query be changed to not include the CASE statements and let Oracle do the NULL compare

Van Halbert (JIRA) jira-events at lists.jboss.org
Thu Sep 6 08:53:32 EDT 2012


    [ https://issues.jboss.org/browse/TEIID-2188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12716324#comment-12716324 ] 

Van Halbert commented on TEIID-2188:
------------------------------------

Hm, a paragraph from the oracle docs (last sentence):

Although Oracle treats zero-length character strings as nulls, concatenating a zero-length character string with another operand always results in the other operand, so null can result only from the concatenation of two null strings. However, this may not continue to be true in future versions of Oracle Database. To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string.
                
> When using CONCAT2(x, y), can the source query be changed to not include the CASE statements and let Oracle do the NULL compare
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TEIID-2188
>                 URL: https://issues.jboss.org/browse/TEIID-2188
>             Project: Teiid
>          Issue Type: Enhancement
>          Components: Query Engine
>    Affects Versions: 7.4.4
>            Reporter: Van Halbert
>            Assignee: Steven Hawkins
>
> When CONCAT2(x, y) is used, the rewritten query is very verbose in adding a CASE statement to check for nulls.  Can the rewritten query not include the CASE statements and just let Oracle do the compare, because it can do it more efficiently within the CONCAT call?
> Example:
> select concat2(f1,f2) from table1
> results in
> SELECT c_0 FROM (SELECT CASE WHEN to_char(g_0.f1) IS NULL AND g_0.f2 IS NULL THEN NULL ELSE concat(nvl(to_char(g_0.f1), ''), nvl(g_0.f2, '')) END AS c_0 FROM table1 g_0)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list