NULL values in service management LESS

Hello

I have the query unless you return through two date fields date... NULL values should be ignored in the calculation. I used the service LESS with NVL but not able to resolve the issue until I used the function REPLACE top of it to show the value NULL if the query returns date of NVL. Please find the tables and queries that I used...
CREATE TABLE TEST_LEAST
(RECORD NUMBER,
DATE1 DATE,
DATE2 DATE,
DATE3 DATE);
INSERT INTO TEST_LEAST VALUES (1, '1 AUG 2009', '23 JUN 2009', '4 APR 2009');
INSERT INTO TEST_LEAST VALUES (2, '20 JAN 2009', '16 FEB 2009', '7 MAY 2009');
INSERT INTO TEST_LEAST VALUES (3, NULL, '31 MAR 2009', '19 JUL 2009');
INSERT INTO TEST_LEAST VALUES (4, NULL, NULL, NULL);
COMMIT;
To return date less date1 and date2, date3, I used the function LESS, but the result was not as expected with the following query:
SELECT RECORD, LEAST(DATE1, DATE2, DATE3) FROM TEST_LEAST;
Statement 3 should show a date of March 31, 2009.

I changed the query to use NVL to handle NULL values...
SELECT CASENBR, LEAST(NVL(DATE1, TO_DATE('31 DEC 9999')), NVL(DATE2, TO_DATE('31 DEC 9999')), NVL(DATE3, TO_DATE('31 DEC 9999'))) FROM TEST_LEAST;
.. but now, the result shows that record 4 is December 31, 2009, instead of NULL.
and finally, I replaced the date 31 DEC 2009' with null with this query...
SELECT CASENBR, REPLACE(LEAST(NVL(DATE1, TO_DATE('31 DEC 9999')), NVL(DATE2, TO_DATE('31 DEC 9999')), NVL(DATE3, TO_DATE('31 DEC 9999'))), TO_DATE('31 DEC 9999'), NULL) FROM TEST_LEAST;
I am not convinced with query then thought to ask THE GURUS for help. Please guide me how I can better handle nulls with LESS function.

Thanks in advance!

Use COALESCE with the first expression that column:

SQL> SELECT RECORD, LEAST(COALESCE(DATE1,DATE2,DATE3),COALESCE(DATE2,DATE3,DATE1),COALESCE(DATE3,DATE1,DATE2))FROM TEST_LEAST;

    RECORD LEAST(COA
---------- ---------
         1 04-APR-09
         2 20-JAN-09
         3 31-MAR-09
         4

SQL> 

SY.

Tags: Database

Similar Questions

  • Getting the value of the variable defined in the component cfg file in the Service Manager.

    Hello
    I have a component custome and I need to set a variable in the cfg of the component file and I need to access this variable in my personal (using java) service manager.
    Can someone tell me how to get the value of the variable in the Manager.

    The link should load now.

    The Basic code is:
    String value = SharedObjects.getEnvironmentValue ("variableName");

    Jonathan
    http://jonathanhult.com

  • indicates the column NULL values if I need display - (hifen or less symbol)

    In the Obiee displays NULL values if I need display - (hifen or less symbol),
    Please someone help me...


    Thank you
    René-coral

    If your column is around, then she can raise error. Try:
    IFNULL (cast (column as a varchar (10)), '-')

  • How to manage a transitional calculated attribute in my vo than sometimes groovy expression of null values?

    Mr President

    My worm jdev is 12.2.1

    In my transient VO sometimes attribute I have null values in the expression groovy

    (Purqty*Unitpurprice)+ (Purqty*Unitpurprice)*Staxrate/100
    

    Some products have sales tax rates, and some have Staxrate NULL.

    And I get the following error because of this.

    NULL ERRORS.png

    My question is that how to avoid this error.

    Concerning

    You can do a null control in your expression.

    If (Staxrate! = null & Salestax! = null) {}

    Return ((Purqty*Unitpurprice) + (Purqty * Unitpurprice) * Staxrate/100)

    }

    else {}

    Returns 0

    }

  • management of NULL values in a statement PIVOT 11 g

    Hi all

    In the following code, how can I get the cell showing 80001_sum_sales for employee 234567 as a zero instead of a NULL value?
    with t1 as 
    (
     select 123456 as emp_id, 80000 as category, 10 as sales from dual union all 
     select 123456 as emp_id, 80001 as category, 20 as sales from dual union all
     select 234567 as emp_id, 80000 as category, 10 as sales from dual 
    )
    select *
      from t1 pivot ( sum(nvl(sales,0)) as sum_sales for category in (80000, 80001));
    I tried NVL in various parts of the application, but the problem is that the line does not actually exist to apply the NVL to. I also tried to add another level of subquery factoring to wrap each column in an NVL, something like:
    with t1 as 
    (
     select 123456 as emp_id, 80000 as category, 10 as sales from dual union all 
     select 123456 as emp_id, 80001 as category, 20 as sales from dual union all
     select 234567 as emp_id, 80000 as category, 10 as sales from dual 
    ), 
     t2 as (select *
            from t1 pivot ( sum(sales) as sum_sales for category in (80000, 80001)) )
    select emp_id,
           nvl(80000_sum_sales, 0) as "80000"
           nvl(80001_sum_sales, 0) as "80001"
           from t2;
    but Oracle has a problem with the fact that the column name starts with a number and get ORA-00911. Something like:
    with t1 as 
    (
     select 123456 as emp_id, 80000 as category, 10 as sales from dual union all 
     select 123456 as emp_id, 80001 as category, 20 as sales from dual union all
     select 234567 as emp_id, 80000 as category, 10 as sales from dual 
    ), 
     t2 as (select *
            from t1 pivot ( sum(sales)  for category in (80000, 80001)) )
    select emp_id,
           nvl(80000, 0) as "80000",
           nvl(80001, 0) as "80001"
           from t2;
    shows just the values 80000 and 80001 rather than actual sales amounts. Unfortunately, my requirement is that these column headers must be digital, as is an interface in another system. I try to avoid a full outer join a list of categories to all employees, as my employee table has 180 m files in there.

    Are there SQL gurus out there who can see a way around this problem, before I attempt an outer join complete?

    Thank you
    Matt

    Hello

    Try this

    with t1 as
    (
     select 123456 as emp_id, 80000 as category, 10 as sales from dual union all
     select 123456 as emp_id, 80001 as category, 20 as sales from dual union all
     select 234567 as emp_id, 80000 as category, 10 as sales from dual
    ),
     t2 as (select *
            from t1 pivot ( sum(sales)  for category in (80000, 80001)) )
    select emp_id,
           nvl("80000", 0) as "80000",
           nvl("80001", 0) as "80001"
           from t2;
    

    see you soon

    VT

  • Null value? What the h is a Null value in my registry events?

    while I'm compensation of errors I have 1 last error, apparently harmless but annoying nonetheless, I want to get all these events "Null" out of my system.

    Log name: System
    Source: Service Control Manager
    Date: 23/02/2013-11:54:52
    Event ID: 7026
    Task category: no
    Level: error
    Keywords: Classic
    User: n/a
    Computer: INTL
    Description:
    The next (s) starting or starting system could not load:
    Null value
    The event XML:
    http://schemas.Microsoft.com/win/2004/08/events/event">
     
       
        7026
        0
        2
        0
        0
        0 x 8080000000000000
       
        9113
       
       
        System
        INTL
       
     

     
       
    Null value

     

    your help is appreciated, thanks

    Al Adams

    Hello

    Thanks for the reply.

    Your question does contain all the required information necessary for us to help you. Please provide us with more information to continue troubleshooting as a result.

    See the link on how to ask questions or help on the Forums.

    Suggestions for a question on help forums: http://support.microsoft.com/kb/555375

    Thank you.

  • NULL values in partition Table of Partition key

    Hi all

    I'm using Oracle 11.2.0.3.

    I can add a null value on partition of Partition table key.

    If so, how?

    Kind regards.

    • You cannot specify NULL in the VALUES clause.

    Referring to clauses PARTITION you set - not the data that you insert.

    If you cannot define a range partition that uses the VALUES LESS THAN and use null to this division. But you CAN use NULL values in the VALUES of integration clause.

    DROP TABLE mytable;

    CREATE TABLE MyTable

    (

    CREATION_DATE DATE,

    Identification number

    )

    PARTITION BY RANGE (CREATION_DATE)

    (

    PARTITION prior_to_2016 VALUES LESS THAN (TO_DATE ('2016-01-01', 'YYYY-MM-DD'));

    LESS THAN PARTITION of VALUES undesirable (MAXVALUE)

    )

    Insert into myTable values (null, null)

    You can use a VALUES clause to insert NULL values - this line will go into the MAXVALUE partition.

  • How to replace a. null value in obiee report

    Hi gurus,

    In a single column, we get. as the data, how to replace. with the null value

    Please provide your inputs

    Thank you for your time in advance

    Try it out below mentioned formula.

    REPLACE ('service request'. "RS #"(, '.', '') "

  • ORA-12519: appropriate service manager TNS:no found error

    Hi gurus,

    I saw a 11.1.2.3.500.4435 environment with financial management and the FDM to the same server and I get the following error message when I try to deploy a HFM application:

    Error 11; hypadmin; 12/06/2014 12:01:54; HfmADOConnection.cpp; Line 591; <? XML version = "1.0"? >

    < C'estr > < Ref > {C8D1FE60-7743-465B-ACA1-509C59EC4A75} < / Ref > < AppName / > < user / > < DBUpdate > 1 < / DBUpdate > < CSEC > < Num >-2147467259 < / Num > < Type > 1 < / Type > < DTime > 2014/06/12 12:01:54 < / DTime > < Svr > RJ1 - 2 K 8-BI-P06 < / Svr > < file > HfmADOConnection.cpp < / file > < line > 591 < / line > < worm > 11.1.2.3.500.4435 < /. Worm > < DStr > ORA-12519: found appropriate TNS:no services manager < / DStr > < / CSEC > < / RTSs >.

    I know that the problem is related to the TNSNAMES file. ORA and I have Oracle Client 32 and 64-bit installed. My TNS_ADMIN variable has the value D:\Oracle\Middleware\dbclient32\network\admin;D:\Oracle\Middleware\user_projects\config\dbclient and my path variable is set to D:\Oracle\Middleware\dbclient64\BIN;D:\Oracle\Middleware\dbclient32\bin;%PATH%

    Also, I ORACLE_SID defined as a variable of environment but still having the error above.

    Some know how to correctly predict the environment databases in order to get the connection?

    Thanks in advance

    Hello

    Might or might not help, no harm trying though.

    ORA-12519: Manager TNS:no of appropriate service found tips

    Try to change the number of processes.

    Warm greetings,

    Jjun

  • NULL value in Radio buttons 11.1.1.6.2 OBIEE

    Hello

    I use OBIEE 11.1.1.6.2. When we create fast with radio buttons, I was able to learn a button with a NULL value.
    Even if add a where condition clause to restrict the values Null his watch upward.

    I have the same problem with the check box.

    Is this a Bug in this version?

    Thank your.
    MBVAnand

    Hello

    Uncheck the option 'nullable' for this column in the physical layer and restart presentation services. It should disappear.

    Paul
    http://total-bi.com

  • creating table of partition with null values

    Hello

    I have a table with 20 GB of data. I changed this table in the table to partition with partition of the range
    the column with which I took for range (date), holding the values null

    can I have a partition for null values?

    Hello

    CREATE TABLE ICBS. KNET_STMT_EXTRACT_NEW_P
    (
    SRVC_TYPE VARCHAR2 (200 BYTE),
    FILLER_1 VARCHAR2 (200 BYTE),
    RTE_STAT VARCHAR2 (200 BYTE),
    TRAN_DATE VARCHAR2 (200 BYTE),
    TRAN_TIME VARCHAR2 (200 BYTE),
    POST_DATE VARCHAR2 (200 BYTE),
    DATE OF REC_INSERT_DT,
    DATE OF PROCESSED_DATE,
    KNET_RECON_RESSON VARCHAR2 (100 BYTE),
    NEW_TRAN_DATE VARCHAR2 (10 BYTE),
    REASON VARCHAR2 (200 BYTE)
    REASON_IND NUMBER (5),
    NODE_ID VARCHAR2 (8 BYTE),
    PROGRAM_ID VARCHAR2 (8 BYTE),
    USER_ID VARCHAR2 (8 BYTE),
    TIME_STAMP DATE
    )
    ICBS TABLESPACE
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE)
    64K INITIALS
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    DEFAULT USER_TABLES
    )
    LOGGING
    PARTITION BY RANGE (REC_INSERT_DT)
    (

    KNET_STMT_EXTRACT_NEW_P_DEC11 PARTITION VALUES LESS THAN (TO_DATE (' 2012-01-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))
    LOGGING
    NOCOMPRESS
    ICBS TABLESPACE
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE)
    INITIAL 1 M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    DEFAULT USER_TABLES
    ),
    KNET_STMT_EXTRACT_NEW_P_JAN12 PARTITION VALUES LESS THAN (TO_DATE (' 2012-02-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))
    LOGGING
    NOCOMPRESS
    ICBS TABLESPACE
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE)
    INITIAL 1 M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    DEFAULT USER_TABLES
    ),
    PARTITION KNET_STMT_EXTRACT_NEW_P_MVAL VALUES LESS THAN (MAXVALUE)
    LOGGING
    NOCOMPRESS
    TABLESPACE TBL_MAXVALUE
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE)
    INITIAL 1 M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    DEFAULT USER_TABLES
    )
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING
    ALLOW THE MOVEMENT OF THE LINE;

    Published by: hitgon on April 30, 2012 10:56

    Published by: hitgon on April 30, 2012 10:58

    Published by: hitgon on April 30, 2012 10:59

  • FTS by select as NOT NULL values

    Hello

    My version of Oracle is 10.2.0.3.0.

    I'm shot under SQL in the database, this SQL is a FTS during the race.

    SELECT *.
    Table_name FROM
    WHERE id_number IS NULL;

    Pease see below for the nature of the existing data in the table.

    SQL > select count (*) from table_name where id_number is null;

    COUNT (*)
    ----------------
    1456

    SQL > select count (*) from table_name;

    COUNT (*)
    ----------------
    9392730

    However, there is an index on the column id_number and the SQL where clause (where id_number is null) picks up only 0.1% of the rows in the table. Although SQL is a FTS on the table table_name. Is there a way I can remove this execute SQL FTS.

    Thanks in advance.

    Best regards
    oratest

    oratest wrote:
    Means there is no another way/workaround to grant this SQL? :(

    Major responses in this thread.

    If you change the SQL statement or set up a bitmap index (not a good choice index if the table is subject to frequent changes), there is another solution. I think I've seen this approach on the blog of Richard Foote:
    http://richardfoote.WordPress.com/2008/01/23/indexing-nulls-empty-spaces/

    Here's a sample:

    CREATE TABLE T1(
      C1 NUMBER NOT NULL,
      C2 VARCHAR2(50) NOT NULL,
      C3 NUMBER,
      C4 VARCHAR2(300));
    
    INSERT INTO T1
    SELECT
      ROWNUM,
      TO_CHAR(ROWNUM,'0000000')||'A',
      DECODE(MOD(ROWNUM,1000),0,NULL,ROWNUM),
      LPAD('A',300,'A')
    FROM
      (SELECT
        ROWNUM RN
      FROM
        DUAL
      CONNECT BY
        LEVEL <= 1000) V1,
      (SELECT
        ROWNUM RN
      FROM
        DUAL
      CONNECT BY
        LEVEL <= 1000) V2;
    
    CREATE INDEX IND_T1_C3 ON T1(C3);
    
    EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=>USER,TABNAME=>'T1',CASCADE=>TRUE)
    

    The foregoing has created a ranking table 1 000 000, where 1 of 1,000 rows contains a NULL value. An index has been created and then on the table, and the statistics have been updated.

    Now the first test:

    SET AUTOTRACE TRACEONLY EXPLAIN
    
    SELECT
      COUNT(*)
    FROM
      T1
    WHERE
      C3 IS NULL;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3724264953
    
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |     1 |     5 | 10994   (2)| 00:00:45 |
    |   1 |  SORT AGGREGATE    |      |     1 |     5 |            |          |
    |*  2 |   TABLE ACCESS FULL| T1   |  2000 | 10000 | 10994   (2)| 00:00:45 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
       2 - filter("C3" IS NULL)
    

    Note that the index is not used. A second test with a slightly modified definition of the index:

    CREATE INDEX IND_T1_C3_NULL ON T1(C3,' ');
    
    EXEC DBMS_STATS.GATHER_INDEX_STATS(OWNNAME=>USER,INDNAME=>'IND_T1_C3_NULL')
    
    SELECT
      COUNT(*)
    FROM
      T1
    WHERE
      C3 IS NULL;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 265035506
    
    ------------------------------------------------------------------------------------
    | Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |                |     1 |     5 |    25   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |                |     1 |     5 |            |          |
    |*  2 |   INDEX RANGE SCAN| IND_T1_C3_NULL |  2000 | 10000 |    25   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
       2 - access("C3" IS NULL)
    

    This time notice that the special index was used without having to change the SQL statement.

    Charles Hooper
    Co-author of "Expert Oracle practices: Oracle Database Administration of the Oak Table.
    http://hoopercharles.WordPress.com/
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • Null values for DB2 are causing problems

    Hello
    I have another problem with the link to the database to DB2 on IBM iSeries Access for Linux 64-bit OEL5 with gateway database Oracle and unixODBC 2.2.14.
    DB link works. However, null values for DB2 are causing problems. "The columns Date null on db2 return a date ' 30.11.0002 ', and the columns of characters that are null return an error ORA-28528: heterogeneous Services data type conversion error.
    isql returns the correct results.

    How can I fix? May set some parameters for the conversion of the data on the entry door?

    Thank you.

    If the driver is not fully ODBC level 3 compliant and functions of the spleen, we are lost. But sometimes drivers ODBC level 3 compliant, but lack the correct implementation of 64-bit. In these cases, we can tell the gateway to use the 32-bit ODBC 3 standard adjustment level in the gateway init file:
    HS_FDS_SQLLEN_INTERPRETATION = 32

  • JDev 11 g: problem view VO criteria ignore Null values

    Hello

    I don't know if it's a bug or do something wrong but here is my case:
    I created an original Version of a database table.
    In page view of all of VO, aaa I bind a variable named
    Then I add a criteria-> display I add an element of criteria including bing my previously create variable to an attribute of VO-> I have defined validation on "necessary".
    Then a race my request and made a few test/dev.

    After a while, I needed to change my display criteria 'optional' with 'Ignore Null values' checked.
    I changedit, run my application and the display criteria did not work... I don't add no rows returned when I went to my variable named "null".
    After 1 or 2 days to research, I managed to notice that in fact, an attribute is missing in my VO object source.

    I needed to add explicitly in the XML of the source of this attribute:
    GenerateIsNullClauseForBindVars = 'true '.

    in the desired so ViewCriteriaItem it ignores Null values.

    I tried various combinations of the interface for presentation but non of them generated this attribute set to "true".
    Only when I put the validation 'Optional' and ' ignore values null ' unchecked, GenerateIsNullClauseForBindVars = 'false' appears in the XML source code.

    Is this a bug?
    Here's my version JDev: Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407

    Jack

    To report a bug, you must go through the MOS (aka Metalink). You need a support contract valid to log into MOS.

    Timo

  • Service Manager Console 2012 can create tickets via email through any kind of process/workflow?

    Original title: create tickets by e-mail

    Hey guys,.

    I need to create a support metric and most of our users are used for sending emails to the support mailbox and do not connect a ticket. Service Manager Console 2012 can create tickets via email through any kind of process/workflow? I know another system that can - I did not know if the MSC can?
    I hope that makes sense.  THX,

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

Maybe you are looking for

  • Cannot save file \resource &lt; labview &gt; element to the previous version

    Hello I have a quick fall plugin written in LabVIEW2013, without any new feature. I am recording this plugin in the previous version, but I get this message: "unable to save the items in the \resource folder to the previous version. Even after the re

  • Evolution of Windows Live ID

    When I go to live.com and login and go to my account and click on 'Edit' next to my current ID, and I enter a new email address I use, I get the following error "there is a temporary problem with the service. Please try again. If you continue to rece

  • Windows Boot Manager error. Status 0xc00000e9?

    "Windows has encountered a problem communicating with a device connected to your pc. This error can be caused by unplagging a removable storage device... or by faulty hardware such as a hard disk or CD-ROM. make sure that all removable storage is pro

  • Videos do not play on windows media player

    only a few days earlier, I was able to 'play' a video.    When I download in a temp folder now only allows me to listen to... not watch the video of the sequence.

  • BlackBerry software where can I find the latest version of the software for PC Blend?

    I've updated the app mixes on my passport and now it does not connect to my PC.  It says that I have to update the software on the computer, but when I go to http://ca.blackberry.com/software/desktop/blackberry-blend.html# and click on download Black