How to generate values null?

Hello
I have a nice select which produces this output:
Sum of the value
42 02/1997
35.6 06/1997
17.6 07/1997
97,2 08/1997
42 10/1997
71.8 11/1997
90.6 12/1997

I want to see zero if for the month, that data is not provided, this would gives this result:

Sum of the value
0 01/1997
42 02/1997
0 03/1997
0 04/1997
0 05/1997
35.6 06/1997
17.6 07/1997
97,2 08/1997
0 09/1997
42 10/1997
71.8 11/1997
90.6 12/1997

He comes to select nice I use:

SELECT TO_CHAR (titi, "MM/YYYY") value.
Toto "stacking".
DE)
with precipitation as
(
Select date1 rainfalldate, value
of evv_stpl
where clef_var = 4542
and between date1
TO_DATE ("0101" |) ""1997"|" 000000', 'DDMMYYYYHH24MISS') and to_date ("0101" |) ""1997"|" 235959', 'DDMMYYYYHH24MISS') 365
order of date1
)
Select trunc (rainfalldate, 'MM') titi, toto (toto) sum of
(select rainfalldate, value, lead (value) over (partition by order of trunc (rainfalldate) of rainfalldate),
(Value) lead over (partition by order of trunc (rainfalldate) of rainfalldate) - value toto
precipitation
)
where toto > = 0
Trunc Group (rainfalldate, 'MM')
order by trunc (rainfalldate, 'MM')
)


Data:
Insert into 'evv_stpl' ('Clef_var', 'Date1', 'Value') values (4542,' 02/1997 ', 42);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542,' 06/1997 ', 35, 6);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542,' 07/1997 ', 17, 6);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542,' 08/1997 ', 97, 2);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542, 10/1997 ', 42);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542, 11/1997 ', 71, 8);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542, 12/1997 ' 90, 6);
Insert into 'evv_stpl' ('Clef_var', 'Date', value) values (4542,' 01/1998 ', 1, 8);

Could you help me? I know that I have to generate a list of months and a value of zero and to join these two tables. Despite my best efforts, I could not arrive at a result. Thank you very much for your help!

Christian

for some reason, you missed the join external on your last question, when he was on your old one (the {noformat} (+) {noformat}). If you want your activation date shaped in a particular way, you need the to_char on the external final selection. Always leave the stuff of formatting until as late as possible, in this way, you have lots of information in your calculations, etc.

This should be what you are looking for:

WITH RAINFALL AS (SELECT DATE1 RAINFALLDATE,
                         VALEUR VALUE
                  FROM   EVV_STPL
                  WHERE  CLEF_VAR = 4542
                  AND    DATE1 BETWEEN TO_DATE('0101'||'1997'||'000000', 'DDMMYYYYHH24MISS')
                                       AND
                                       TO_DATE('0101'||'1997'||'235959', 'DDMMYYYYHH24MISS') +365
                  ORDER BY DATE1),
       MONTHS AS (SELECT ADD_MONTHS(TO_DATE('01/1997', 'mm/yyyy'), LEVEL-1) DT
                  FROM DUAL CONNECT BY LEVEL <= 12),
       MY_TAB AS (SELECT TRUNC(RAINFALLDATE, 'MM') VALUE,
                         SUM(TOTO) CUMUL
                  FROM   (SELECT RAINFALLDATE,
                                 VALUE,
                                 LEAD(VALUE) OVER (PARTITION BY TRUNC(RAINFALLDATE)
                                                   ORDER BY RAINFALLDATE) - VALUE TOTO
                          FROM RAINFALL)
                  WHERE TOTO >= 0
                  GROUP BY TRUNC(RAINFALLDATE, 'MM'))
SELECT TO_CHAR(MONTHS.DT, 'MM/YYYY') VALUE,
       NVL(MT.CUMUL, 0) CUMUL
FROM   MY_TAB MT,
       MONTHS
WHERE  MONTHS.DT = MT.VALUE (+)
ORDER BY MONTHS.DT;

Published by: Boneist on June 26, 2009 09:41

Oops; I forgot to add the to_char in!

Tags: Database

Similar Questions

  • full outer join: how to get without null values?

    full outer join: how to get without null values?

    Hello

    Please go well this url

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:999478429860455:P11_QUESTION_ID:6585774577187

    Thank you
    Prakash P

  • How to convert the Null value to 0 after the outer join?

    Hello guys

    My requirement is in fact 2 of outer join tables (that's how), and I got the outer join works very well, so in my report, I have values null of measures in another table of facts as a result of the outer join...

    Is there a way I can convert these nulls to 0?

    I realized that the null value is not stored in the table, it is just following the outer join because the NULL do not match records in other... So by default, I'm expected to get NULL values...

    Is there way to present these nulls to 0?

    Thanks a lot for your advice

    In response, the syntax will be:

    IFNULL (, 0)

    try and let us know how you go.
    See you soon
    Alastair

  • Siri in him sending text with the value 'NULL '.

    When I say, "Siri, text my wife, 'X', ' Siri responds correctly,"here is your message to Jill: 'X'. "" "  "Ready to send it?"  I say 'Yes' and sends the message.  As soon as I get a text from my carrier saying the recipient of the message was invalid.  100% of the time, I see that Siri has sent a text with the value NULL.

    I tried to restart my phone.  I tried to remove and re-add my contacts.  Anyone else having this problem?  Someone knows how to solve?

    If it's by the carrier, you should contact them and see what they receive in return for their side. Ive had Siri send messages for me and I have never seen this one IOS.

  • How to generate 3 Wick using digital signals

    Hello

    I am in the course of generations bit 3 digital using 9403 digital module and cRIO 9014.I signal must generate all combinations from 000 to 111.la so I have to give the Boolean constant either true or false 9403.I output module'm not gettimg how incrase step value of 000 001 and so on... Should I use the shift register?

    I know how to use the registry to offset for integer value bt I don't hv any idea on the Boolean value.

    in the hope of solution...

    Here is a small example that uses the number to array of Boolean function.  The digital indicator has its display of the binary value (%b) formatting.

  • How to replace a "null" in the date field to zero

    Hi guys,.

    I'm a lil stuck with this problem.
    I have a requirement where I need to replace a null value in the date field to zero.
    For example,.

    Cancel_date Cancel_date
    20120301 20120301
    20120908 20120908
    value null-> > > > > 0


    Thank you
    Anita

    Hi, Anita,.

    0 is not a DATE, so you cannot view it in a DATE column.
    There is no '0' display problem in a VARCHAR2 column, so use TO_CHAR to display dates, even if the default format, it's exactly what you want.

    SELECT     NVL ( TO_CHAR (date_column, 'YYYYMMDD')
             , '0'             -- or '       0', if you want it right-justified
             )          AS date_string
    FROM     table_x
    ;
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Generate values for automatic fields

    Dear gurus,

    I want to generate automatic value for each field in the form, as for example in the course of field OLM code or any field in any application how can I fill with automatic generated value each time as sequence concatenated with some characters?

    Thank you

    Visit this link
    http://apps2fusion.com/apps/14-FWK/195-OA-framework-R12-extension-example

    Thank you

  • The values NULL in Rosetta Net received recognition for SOA 11.1.1.5

    Hello

    My business partners are reporting that they have consumer issues of the receipt we send them

    That's because we send it null values or wrong

    Can you tell me how can I fix?

    Here is an example

    <? XML version = "1.0" encoding = "UTF-8"? >

    <! DOCTYPE ServiceHeader SYSTEM "ServiceHeader_MS_V02_00.dtd" >

    < ServiceHeader >
    < ProcessControl >
    < ActivityControl >
    < BusinessActivityIdentifier > notify of advance shipment < / BusinessActivityIdentifier >
    < Messagecontroler >
    < fromRole >
    Receiver of < GlobalPartnerRoleClassificationCode > < / GlobalPartnerRoleClassificationCode >
    < / fromRole >
    < fromService >
    < GlobalBusinessServiceCode >sending Service< / GlobalBusinessServiceCode >
    < / fromService >
    < inReplyTo >
    < ActionControl >
    < ActionIdentity >
    < GlobalBusinessActionCode > Advance Shipping Notification Action < / GlobalBusinessActionCode >
    < messageStandard >
    < FreeFormText > null < / FreeFormText >
    < / messageStandard >
    < standardVersion >
    value null < IdentificateurVersion > < / IdentificateurVersion >
    < / standardVersion >
    < / ActionIdentity >
    < messageTrackingID >
    < InstanceIdentifier > 3683 < / InstanceIdentifier >
    < / messageTrackingID >
    < / ActionControl >
    < / inReplyTo >
    <>Manifesto
    < numberOfAttachments >
    < CountableAmount > 0 < / CountableAmount >
    < / numberOfAttachments >
    < ServiceContentControl >
    < SignalIdentity >
    Acknowledgement of < GlobalBusinessSignalCode > < / GlobalBusinessSignalCode >
    < IdentificateurVersion > V02.00 < / IdentificateurVersion >
    < / SignalIdentity >
    < / ServiceContentControl >
    < / manifesto >
    < toRole >
    sender < GlobalPartnerRoleClassificationCode > < / GlobalPartnerRoleClassificationCode >
    < / toRole >
    < toService >
    < GlobalBusinessServiceCode >null< / GlobalBusinessServiceCode >
    < / toService >
    < / Messagecontroler >
    < / ActivityControl >
    Production of < GlobalUsageCode field > < / GlobalUsageCode field >
    < pipCode >
    3 b 2 < GlobalProcessIndicatorCode > < / GlobalProcessIndicatorCode >
    < / pipCode >
    < pipInstanceId >
    < InstanceIdentifier > gwf://10632/Notify of dispatch of advance < / InstanceIdentifier >
    < / pipInstanceId >
    < pipVersion >
    < IdentificateurVersion > V01.00 < / IdentificateurVersion >
    < / pipVersion >
    < KnownInitiatingPartner >
    < PartnerIdentification >
    < domain >
    DUNS < FreeFormText > < / FreeFormText >
    < / domain >
    < GlobalBusinessIdentifier > 055991053 < / GlobalBusinessIdentifier >
    < / PartnerIdentification >
    < / KnownInitiatingPartner >
    < / ProcessControl >
    < / ServiceHeader >


    Thank you for your help

    Please log a service request with support. I think you hit a known issue.

    Kind regards
    Anuj

  • Calculated field with the currency formatting, and hiding the values null

    I am designing a PDF form for quote and I have a field defined to multiply the amount of an article and the unit price to the total price.  There are 5 lines on each quote, and if users are citing only 1 or 2 items I want the values null in fields unused price extended to be hidden.

    I did it with the following script

    If (event.value == 0) event.value = ";

    But when I enter the quantity and total price of price is displayed as a regular number (100) instead of currency ($100).

    I can format to currency with

    Event.Value = util.printf ("$%.2f", event.value);

    I don't know there's a way to combine to give rise to such a situation then, so if the field is 0, make null and if not then format as currency but I don't know how to do it.

    Any help would be appreciated.

    Andrew

    Newer versions of Acrobat hide zero for fields values using the number format and with a currency symbol. »

    But since you can't control the updating of user systems, you must use a small function documented for formatting numeric fields on the fly.

    With the extended price field set to 'None' format, you can add the following script to the Validation script "Custom" or add it to a custom JavaScript calculation. The "Custom Validation will work with any method of calculation. Note that the form must be cleaned or recalculated to see the result of the validation script change.

    if(Event.Value == 0) {}
    Event.Value = ""; set the field value to null to a value of zero
    AFNumber_Format (2, 0, 0, 0, "", true); number with no currency symbol format
    } else {}
    AFNumber_Format (2, 0, 0, 0, "$", true); for the format of the values non-null for number with the currency symbol
    }

    The positional parameters are the number of decimal places, the Style separator, negative value Style, Style of (unused) currency, currency symbol, the currency symbol Pre-hanging chain.

  • LOV selection list with submit the value Null

    I have a select list with submit in which another fileld fills based on the selection. I have the TEXT Null in the LOV "Select Vendor" value but I do not know how to set the Null VALUE, while I get this error:

    ORA-01722: invalid number
    Calculation of default value of the element of error ERR-1019: page = 2 name = P2_VEND
    Ok

    I tried the following to the default value of the select list with submit without result:
    Replace (: P2_VEND, '%' | 'null %', null)

    Thanks in advance.

    Hello

    You can set the NULL value - 1 (or any other provider code which may not exist).

    Greetings,
    Roel

    http://roelhartman.blogspot.com/

  • Anyone know how to enter values containing / by the numbers?

    Anyone know how to enter values containing / numbers?  I am trying to enter values of blood pressure requiring this symbol.  Thank you

    You can force numbers does not interpret the value as a number by typing the single quote... like this:

    120/72

    the column text format or

    or enter systolic diastolic and columns in then next:

    Systolic

    Diastolic

    120

    72

    124

    80

  • How to generate random numbers from 1 to 5

    How to generate random numbers from 1 to 5

    -1110340081

    Thank you I ended up

  • How to generate an impulse to test short circuit in an inducer

    Hello

    IM new to labview and am in need of complete SURG - SURGE STRESS TEST

    This test is intended to detect a short tour inter by applying a number of high
    voltage pulses (or surge) for the selected winding.
    Each pulse should produce one sinusoidal transient that eventually decreases to zero.

    How to generate the impulse using labview.

    Hi Jessica,.

    Please see the "pulse pattern.vi" function--> pallets of signal processing signal generation.

    Otherwise, you can browse through examples of LabVIEW.

    Kind regards

    Srikrishna.J

  • How to generate a vector under LabVIEW?

    How to generate a vector as n = 0:Ts:T in LabVIEW with the need for the mathscript node and with out of the loop?

    Focus on the ramp VI model.  It is located in the treatment-> Palette generation of Signal of the Signal.

  • How to generate curves under labVIEW

    Hi all
    Can someone please tel me how to generate the following curves under LabVIEW.
    Haversine curve 1.)
    2 Lorentz curve.)
    3 bell curve.)
    4.) exponential rise curve
    5. exponential decay curve)

    Note: Entries required for this curves are Amplitude, Phase, Offset
    Frequency and number of samples

    Have you read the second part of my post above?

Maybe you are looking for

  • Siri anniversary incorrect reports

    Hey guys,. I encounter this problem with Siri on my birthday.  I do not want to see my real birthday in this topic of discussion, so I'll just give a date for example.  When I ask her "what is my birthday," she said "August 20".  However, my actual b

  • Network card drivers

    I have a HP HP Probook 4320 s running Windows 7 Professional and I've lost or damaged driver for network controller. The hardware ID is given as PCI\VEN_168C & DEV_002B & SUBSYS_3040103C & REV_01PCI\VEN_168C & DEV_002B & SUBSYS_3040103CPCI\VEN_168C &

  • How can I fix the pci.sys if corruption do not have XP installation disc

    I bought a laptop in 2006 that had Windows XP installed in it.  Yesterday, I installed SP3 for Windows XP update.  I noticed that he hung up during installation. Finally, he gave me a blue screen and when I tried to restart, it tells me that 'system3

  • I just bought a Canon Pro 100 printer.

    Installation went well.  I have PC with Win 7 using CS6.  I calibrate my screen with Spyder 3 monkey.  I can take my files on a printer in the Seattle area, and my impression is my file 99% of the time (night sky images have to be a little more fitte

  • In Windows 7 user account control

    Hello I have a PC with Windows 7. I downloaded Magellan Content Manager to manage my new GPS Magellan, but whenever I double-click on the program to execute, User Account Control stands up and says: 'do you want to allow the following program... '. »