Sum of field in different columns according to dates

Hi Gurus
I have a table s903 with
Type Declaration
                      data:
                      begin of ty_S903 occurs 0,
                         fkdat   like s903-fkdat, " billing date 
                         pkunag  like s903-pkunag," sold to party
                         fkimg   like s903-fkimg, " actual invoice quantity
                         werks   like s903-werks, " plant
                      end of ty_S903.
DATA: it_s903 type standard table of ty_903,
      wa_s903 type ty_903.
I need to calculate SUM(s903-fkimg) for different dates   (s903-fkdat)
The columns are sold to party |JAN, FEB, MAR, APR ....   .
I need to display report as SUM(S903-FKIMG) for JAN in first column,FEB in second, MAR in third , APR in fourth and so on ...........as I select the date range from fkdat
how can I proceed Is there any clue to do so?
do i need to use collect here?
Can you please help me how to do this?
Thanks in advance.
Piroz

Hi,
If your table is based on a view object then you can use a transient attribute and in its value use a groovy expression.
the new attribute should have:
value type: "expression"
value: object.getRowSet().sum('AmountAttribute')"
Drag and drop the new attribute from the data sources to your page and add partialTriggers from the components that affect it
(Insert/Delete buttons and the table field that it sums).
Gabriel.

Similar Messages

  • Sum 2d arrays with different columns width

    hi,
    I have a 2d array that stores the number of rats in X number of houses.
    in each row, i have the number of rats per house (length) and the weight of each.
    So, if I have 3 houses, I would 3 rows (0,1,2).
    And, in house 1: I have 2 rats (0,1)
    then, rat1 weights 20, rat2: 15
    in house 2: I have 3 rats (0,1,2)
    rat1: 30, rat2: 25 rat3: 5
    in house 3: I have 1 rat (0)
    rat1: 50
    So, what I need to do is to calculate the total weight of rats per house and display:
    Total weight in House1: 35
    House2: 60
    House3: 50
    I dont know how to do the sum and display the sum for each house. Any hints/solutions?
    Message was edited by:
    gixty
    Message was edited by:
    gixty

    > yeah, but I am still looking for a way to sum every
    column per row.
    You've been given the same solution on two different forums. If you know how to loop through the houses, you know how to loop through the rats. The "rat loop" will be nested inside the "house loop". Each rat will be identified by two indices; the house index and the rat index. Just loop through the rats, adding each rat's weight to the total for that house.
    ~

  • How to sum different column in the same table

    Hi everyone
    I would like to know how can I make the sum of different column in the same table using apex
    exple:
    TR_PROJ_BIL_TRIM.ENTPIDFISC as ENTPIDFISC,
        TR_PROJ_BIL_TRIM.EXEANNEE as EXEANNEE,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV as PROJBILTRIMT1PREV,
        TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV as PROJBILTRIMT2PREV,
        trunc( TR_PROJ_BIL_TRIM.PROJBILTRIMT1PREV)+(TR_PROJ_BIL_TRIM.PROJBILTRIMT2PREV)
    from TR_PROJ_BIL_TRIM TR_PROJ_BIL_TRIM
    group by TR_PROJ_BIL_TRIM.ENTPIDFISC,TR_PROJ_BIL_TRIM.EXEANNEE
    but while trying to run this script i get this error message:"ORA-00979: not a GROUP BY expression"
    thanks for reading me and I hope to hear from you soon

    Hi,
    Your question do not have anything do with APEX.
    It is pure SQL question and you will get better answer this kind questions from SQL and PL/SQL forum
    You need have GROUP BY when you use aggregate functions like SUM.
    I assume you like just add two columns.
    Try
    SELECT ENTPIDFISC
        ,EXEANNEE
        ,PROJBILTRIMT1PREV
        ,PROJBILTRIMT2PREV
        ,trunc(PROJBILTRIMT1PREV) + (PROJBILTRIMT2PREV)
    FROM TR_PROJ_BIL_TRIM
    Regards,
    Jari

  • Sum two different columns from two different tables

    Can you select and sum two different columns, from two different tables in the same sql statement?
    i.e.
    table1
    Item----OnHand_Qty
    A--------10
    A--------15
    B--------10
    B--------10
    C--------20
    table2
    Item----Trx_Qty
    A--------2
    A--------4
    A--------6
    B--------1
    B--------1
    C--------4
    I'm looking for the following results from a query
    Item----Sum(Onhand_Qty)---Sum(Trx_Qty)
    A--------25

    Like this?
    SQL> create table table1 (item,onhand_qty)
      2  as
      3  select 'A', 10 from dual union all
      4  select 'A', 15 from dual union all
      5  select 'B', 10 from dual union all
      6  select 'B', 10 from dual union all
      7  select 'C', 20 from dual union all
      8  select 'D', 30 from dual
      9  /
    Tabel is aangemaakt.
    SQL> create table table2 (item, trx_qty)
      2  as
      3  select 'A', 2 from dual union all
      4  select 'A', 4 from dual union all
      5  select 'A', 6 from dual union all
      6  select 'B', 1 from dual union all
      7  select 'B', 1 from dual union all
      8  select 'C', 4 from dual union all
      9  select 'E', 3 from dual
    10  /
    Tabel is aangemaakt.
    SQL> select nvl(t1.item,t2.item) item
      2       , t1.sum_onhand_qty
      3       , t2.sum_trx_qty
      4    from ( select item, sum(onhand_qty) sum_onhand_qty
      5             from table1
      6            group by item
      7         ) t1
      8         full outer join
      9         ( select item, sum(trx_qty) sum_trx_qty
    10             from table2
    11            group by item
    12         ) t2
    13         on (t1.item = t2.item)
    14  /
    I SUM_ONHAND_QTY SUM_TRX_QTY
    A             25          12
    B             20           2
    C             20           4
    E                          3
    D             30
    5 rijen zijn geselecteerd.Regards,
    Rob.

  • Different Column Fields - Inbox & Sent

    Hello,
    I've recently converted from Windows to Mac.  I successfully setup my Exchange account in Mail 5.0.  I use several devices to send mail from so not all are coming from one mac.
    Under the Mailboxes header in the side bar, I have my generic "Inbox" & "Sent" folders which are displaying fine.  The Inbox has the "From" column and "Sent" has the "To" column.  This Sent folder only shows emails sent from this specific machine.  Again, I use 3 different macs.
    When I go down to the "Sent" folder that shows all emails sent from my Exchange account, it has the "From" column.  Obviously everything came from me so it's useless.  When I click to add the "To" column it adds it here but it also adds it to the generic "Inbox" folder.
    Hopefully this isn't difficult to understand and I explained it clearly.  Basically I want to customize the columns for the indivdual folders and not have the options I set for one folder go across all folders.
    Thanks.

    Column view settings are stored globally for all mailboxes. You cannot change them for one mailbox without also affecting the rest, except Mail allows you to have slightly different From/To and Date Sent/Date Received settings for Sent.

  • Sum defaults to different column

    I have set up a numbers templet for stock prices where I only need to enter the closing price for each stock to update the spreadsheet. I would like the profit to fall in one column and the loss to fall in a different column. Is this possible?

    Hi Richard,
    Enclose the formula calculating profit/loss in IF statements, following this model:
    PROFIT column: =IF(formula>=0,formula,"")
       LOSS column: =IF(formula<0,formula,"")
    If you want the loss figure to appear as a positive number, use this version of the LOSS formula:
       LOSS column: =IF(formula<0,ABS(formula),"")
    Regards,
    Barry

  • Sales Amount from one column of period (FY-2012, FY-2013) to 2 different columns

    Hi dudes,
    I'm having some difficulties in getting the Sales Amount  from one column of period (Fiscal Year containing 2012 and 2013) and put it into 2 different columns (Sales 2012 and Sales 2013. I have 3 fields in my dataset: Sales (for all the years), Fiscal
    Year (more than 5 years) and month (which I can neglect).
    For the moment, my situation is as follows:
    Fiscal Year          Month       
    Sales
    2012                      Jan           $72,500
                                   Feb          $80,200
                                   Dec          $79,500
    2013                      Jan           $51,000
                                   Feb          $62,800
                                   Dec          $85,000
    However I would like to get a scenario as follows:
        Month       
    Sales 2012          Sales 2013
         Jan              $72,500                  $51,000
         Feb             $80,200                   $62,800
         Dec             $79,500                   $85,000
    Once I have this, I would be much easier for me to do the difference between the two sales period.
    Is there any expression I can use?
    I tried to filter from the Group properties the sales amount for Fiscal Year 2012 on 1 column, and on on another column, the sales amount for Fiscal Year 2013 but it is giving me the same values.
    Thank you very much dudes.

    Hi Stan,
    According to your description, we can use a matrix control to achieve your requirement. For more details, please refer to the following steps:
    Drag a matrix from Toolbox to design surface.
    Insert Month field to the first column.
    Insert Fiscal_Year field to the first row of the second column.
    Insert Sales field to the second row of the second column.
    Right-click the second column to add a column with Outside Group-Right option.
    Type the expression below to the second row of the third column:
    =sum(iif(Fields!Fiscal_Year.Value=‘2012’,CDbl(Fields!Sales.Value),CDbl(0)))-sum(iif(Fields!Fiscal_Year.Value=‘2013’,CDbl(Fields!Sales.Value),CDbl(0)))
    The following screenshot id for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Is there a way to create a formula to sum all fields in which a secondary field is a specific string?

    I would like to be able to create a spreadsheet with several different ways of looking at financial results.
    So, while I might have my typical budget prepared by functional area, I would also like to identify whether a line item is a weekly, monthly, or annual expense. So, column A will include a functional header
    Column B the amount itself
    Column C will be the frequency.
    Is there an easy way to create a Sum Field that pulls the info from all fields in which column B = Weekly?
    More importantly, is there a way to do this across multiple tables within a single sheet? I am breaking out divisions into individual tables and performing similar tasks for each division, and then summarizing for the full organization in a separate table.
    I am using Number '09 2.1
    Many thanks,
    Keith

    The more generalized solution is to modify the Summary Table as follows:
    - Add a header row to give the name of the source table for each column (the name you give each table should match the name in the header for each column)
    - use the following formula in B2:
    "=SUMIF(INDIRECT("'"&B$1&"' ::"&"Frequency"), "="&$A2, INDIRECT("'"&B$1&"'::"&"Amount"))"
    fill down, then select B2 - B4, then fill across
    In the "Total" column for the Summary table paste the formula:
    E2:  "=SUM(B2:D2)"
    Fill down
    I hope this helps
    Wayne

  • How to create new form fields in several columns (spreadsheet) and have them named consecutively?

    Hopefully someone can help.  I created a new form from an Excel spreadsheet, but the form field recognition didn't "take" well and very little of the spreadsheet translated into form fields.  I need to create new fields (31) for each column (about 10) and I want the fields in each column to have a keyword from the parent column and the fields numbered consecutively.  I'm really hoping I don't have to do this manually!
    Next, is there a way to total the values in a column of fields (the same as the SUM function in Excel?) or does the form user have to dig out a calculator and add everything?
    Can I create an email (submit) button and direct how (ie email) and by what method the form is sent?
    Once the form is completed, is there a way for the user to lock it before sending it - ie a button they could press to make it no longer fillable?  Or can I set the document to be a regular .pdf once it leaves the host machine?
    I think that's it!  Hopefully someone can help soon - this is a work project that could be potentially very time consuming if I have to create each form field manually.  Thank you for any assistance!
    Cheers,
    LostintheNorth

    LostintheNorth wrote:
    Rats!  Thank you for your link - I may take you up on that... however for the purposes of this form I'm more than halfway done, so I might as well keep plugging away.  A workaround I found was to creat 32 of something I only need 31 of, then delete the parent.  Somehow even playing with spacing on the "create multiple fields" option as the fields are being created only gets the vertical alignment close - no matter what I do I still end up manually aligning (vertically) 31 little boxes for each column so they fit visually.  Grrrr.
    Yes, this can be very tricky. If you don't get the exact right offset between each field, the difference will accumulate and after a while it will be completely off.
    You just have to play around with it, until you get it right. Or almost right, and then adjust it manually.
    Another thing I've noticed, is that when you select one field and right click for properties, you get an expanded version, as opposed to select/shift/enter for a bunch of cells only yields an abbreviated properties box - what's up with that?  Is there a way to change this?  For instance, I had set the properties for a column of 31 cells to be number, 1 decimal place.  Halfway through my project, the lady I am doing the favor for tells me she would like 2 decimal places, requiring me to manually change each box for 62 cells!  Apparently cell formatting is not an option in the abreviated properties dialogue!  Is there a fix for that?
    No, there isn't. Some propeties you have to set manually (or get right the first time, before copying and pasting...). There is a way to do it with a script, but it's a bit complex and requires using an undocumented method.
    This next question is a bit more complicated, and may not be possible.  The form I am creating is for payroll purposes, so at the moment it is generic (31 days) and the user fills in the month manually. Is it possible to get the form to recognize a month value (or create a pulldown menu with a selection of months to choose from) and limit the days accordingly?  Or better yet, run a calendar function so that weekends and stat holidays are highlighted on the affected row?  Kind of like what you can do with an Excel spreadsheet, which is what I designed the form in at the start (then printed to .pdf - the form field recognition did NOT work well on my spreadsheet!  hence me doing every cell manually).  Is this even possible, and if so, is it something I could learn to do?
    Yeah, it's possible, but requires quite a bit of scripting knowledge. If you wish, contact me personally (by PM or email at try6767 at gmail dot com) and I could possibly create this for you.
    If you want to do it yourself, you would have to learn a lot about both the Date object in JS and about the various date printing and scanning methods in Acrobat JS.

  • Set the css style of text in a column according to the value of another col

    I'd like to set the css style of text in a column according to the value of another column. Each field may end up with a different style of text as a result, for instance.
    Any ideas? I looked thru the forums but couldn't find anything.
    Thanks,
    Linda

    Does the class=”t7Header” make it into the rendered HTML?
    ---The text "class="tHeader" does not show but the other text is rendered using the style t7Header as defined in the stylesheet! Exactly what I wanted.
    You might want to use a div or a span instead of a p.
    ---Yes -
    What's very cool is we can create a display column that is dynamically filled with the html and style wrappers based on a lookup to see what style should be applied according to the actual data value. This is critical as our tables are all dynamic so I can't depend on using the additional APEX methods to control the display of a column (as the # of columns in the view vary from instance to instance) and I did not want the display specs to muddy up my SQL queries.
    I wonder why this is not well documented. It is so easy!
    Thanks again for your help.
    Linda

  • Display two different column types in cross tab

    I am using Cross Tab template in crystal XI and I have to show two different column types one is of type int and other is of type string. Below is the format of the report
                                  AmountGiven             Amount Spent            Attended
    Mike                       5000                              3000                         Yes
    Steve                     200                                 200                           No
    Is there a way I can do this showing "yes" or "no" in the third column???
    Thanks...

    Hi
    If you are trying to show "yes" or "no" for a column value in a cross tab, then yes we can try using a formula for it.
    I would suggest you 2 ways that you can try at your end:
    1.
    a) Create a formula in the cross tab expert and write your condition.
    for eg: if Sum({Orders.Order amount}) > 5000 then "yes" else "no"
    b) Then select that formula in the summarized fields in cross tab expert and change the summary to MODE.
    c) You can see the "yes" and "no" Within the same box.
    2.
    a) Add a field to the colums in the cross tab expert.
    b) A column gets inserted in the cross tab.
    c) Right click the field and select format field.
    d) Go to Common tab and write a formula for the display string.
    e) Write the condition in that formula.
    f) You can see a new column with the expected values.
    Hope this helps you..
    Please revert incase of any queries.
    Regards
    Pradeep Hulke

  • Adding up entries of 2 different columns of a table in a single view column

    Hi All,
             I have a requirement wherein I have to add up the entries of 2 different columns of 2 different database tables and show it in one column of a View.
    Eg. Table A has column A and Table B has column B. I create a view C with column C.
    Now Col C = Col A + Col B
    Can anyone please let me know how this view can be created?
    Thanks,
    Momdipa

    Hi Momdipa,
    ABAP Table View does not support dynamic arithmetic operations. So, you can't achieve this business logic in the view. There are no operators in the view which can help you to do this.
    If you need this functionality, you need to create a ABAP Report to calculate the sum on the execution of the Report. And then you can update the View based on your own business logic.
    Hope this helps.
    Thanks,
    Samantak.

  • Amount from 2 different columns. import format?

    Hi all,
    Im trying to import amounts from 2 different columns. If accounts are "123" or "234" or...etc
    Then pull from column
    else use column 9
    can this be done in one import script? I want to know if I can assign import format amount to column 5 but only get the accounts asked for. else use column 9.
    thanks

    I made something like this, and assigned it to an amount column with all the amounts. Does it make sense?
    Function This_Code (strField, strRecord)
    Dim Account
    Dim Ammount
    'Field instead of strRecord
    account = DW.Utilities.fParseString(strField, 12, 5, ",")
    Amount = DW.Utilities.fParseString(strField, 12, 11, ",")
    If Account = "123" or Account = "456" Then
    Amount = This_Code
    End If
    Edited by: tyson33 on Jun 28, 2012 10:11 AM

  • How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

    Hi all,
    I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
    [Arbeitstag],  [Pecunia], [Mita], [Kunde], [Auftrag] and  [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
    Please if any one could help me. i searched a lot in different forums but couldn't find me  a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
    *& Report  ZDEMO_ZEITERFASSUNG9
    REPORT  ZDEMO_ZEITERFASSUNG9.
    Types: Begin of ttab,
            Rec(1000) type c,
           End of ttab.
    DATA: itab  type table of ttab.
    DATA: wa_tab type ttab.
    DATA: file_str type string.
    Parameters: p_file type localfile.
    At selection-screen on value-request for p_file.
                                           CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
                                            EXPORTING
    *                                          PROGRAM_NAME        = SYST-REPID
    *                                          DYNPRO_NUMBER       = SYST-DYNNR
    *                                          FIELD_NAME          = ' '
                                               STATIC              = 'X'
    *                                          MASK                = ' '
                                             CHANGING
                                               file_name           = p_file.
    *                                        EXCEPTIONS
    *                                          MASK_TOO_LONG       = 1
    *                                          OTHERS              = 2
    Start-of-Selection.
      file_str = P_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT'   " This the file  source address
          FILETYPE                      = 'DAT'
          HAS_FIELD_SEPARATOR           = ';'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *     CODEPAGE                      = ' '
    *     IGNORE_CERR                   = ABAP_TRUE
    *     REPLACEMENT                   = '#'
    *     CHECK_BOM                     = ' '
    *     VIRUS_SCAN_PROFILE            =
    *     NO_AUTH_CHECK                 = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        tables
          data_tab                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP at itab into wa_tab.
            WRITE: / wa_tab.
      ENDLOOP.
    I will be grateful to all you experts for ur inputs
    regards
    Chandan Singh

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • What is the difference between   nvl(sum (field), 0) & sum(nvl (field,0)) ?

    What is the difference between nvl(sum (field), 0) & sum(nvl (field,0)) ?
    For the below table data i don't see any different in results
    CREATE TABLE FRUITS
    TYPE VARCHAR2(10 BYTE),
    VARIETY VARCHAR2(10 BYTE),
    PRICE NUMBER(18,2)
    TYPE     VARIETY          PRICE
    apple     gala          2.79
    apple     fuji          0.24
    apple     limbertwig     2.87
    orange     valencia     3.59
    orange     navel          9.36
    pear     bradford     7.77
    pear     bartlett     7.77
    cherry     bing          2.55
    cherry     chelan          6.33
    pear     bradford     
         navel          6.39
    select variety, nvl(sum(price),0)
    from fruits
    group by variety;
    VARIETY     NVL(SUM(PRICE),0)
    limbertwig     2.87
    bartlett     7.77
    bing     2.55
    marathon     0
    gala     2.79
    fuji     0.24
    navel     15.75
    bradford     7.77
    chelan     6.33
    valencia     3.59
    select variety, sum(nvl(price,0))
    from fruits
    group by variety;
    VARIETY     SUM(NVL(PRICE,0))
    limbertwig     2.87
    bartlett     7.77
    bing     2.55
    marathon     0
    gala     2.79
    fuji     0.24
    navel     15.75
    bradford     7.77
    chelan     6.33
    valencia     3.59
    no difference in output.
    what is the difference?
    Thanks in advance

    Do you see the difference now?
    PRAZY@11gR1> create table testing(field number);
    Table created.
    Elapsed: 00:00:00.10
    PRAZY@11gR1> insert into testing select null from dual connect by level<=5;
    5 rows created.
    Elapsed: 00:00:00.00
    PRAZY@11gR1> select * from testing;
         FIELD
    Elapsed: 00:00:00.01
    PRAZY@11gR1> select sum(nvl(field,1)) from testing;
    SUM(NVL(FIELD,1))
                    5
    Elapsed: 00:00:00.00
    PRAZY@11gR1> select nvl(sum(field),1) from testing;
    NVL(SUM(FIELD),1)
                    1
    Elapsed: 00:00:00.00In the former, we are substituting 1 to null value and summing-up. hence we got 5. in the later, we are summing-up the null, which is null and substituting 1 if the result is null. so we got 1.
    Regards,
    Prazy

Maybe you are looking for

  • Report Template: "default: Look 5"

    Hi All, Is it possible to create new report template, derived from "default: Look 5" in HTMLDB 2.0? I need to customized this report template. Thank you. Regards, guntur

  • Where can I find an Owner's Manual for my new MacBook Pro?

    Where can I find an Owner's Manual for my new MacBook Pro?

  • IPod won't sync, no error message nothing freezes

    I originally started with not being able to use iTunes 9 on my new windows 7 notebook. I reinstalled my os and before anything else I installed iTune 9. All went well, I loaded all my music, and even synced my iPod classic 80gb, then it went back to

  • Reg:protocol used in XI

    Hi, After the message is sent from integration engine to advanced adapter engine,through which protocol the AAE receives the message.whether it is XI protocol or HTTP protocol. pls let me know when XI protocol is used and when HTTP protocol is used i

  • Error "Invalid Fetch Size" in ODi11g 11.1.1.6.0 version

    Hi Experts, I am doing Data integration from Excel (using mutltiple sheets data) to Oracle table and now I am facing an below issue Error: ODI-1217: Session EMP_ST1 (24202) fails with return code 8000. ODI-1226: Step EMP_ST1 fails after 1 attempt(s).