Need help finding the average across lines

Hi all

I have a requirement to find a way to several columns in a row. The trickiest part is it may or may not be a value in each of the lines and the average must be calculated for those that have a value. Let me give you an example:

col1 col2 col2, col4

1 NULL 3 5-> average will be (1 + 3 + 5) / 3 = 3
NULL NULL 2 4-> average will be (2 + 4) / 2 = 3.

A (acc to me dump) option is to get the entire file in the variable % ROWTYPE, scan through each of the columns, see if the value is not null and greater than 0, increment the counter (i) and calculate the sum. Finally make a sum / I. An average was 215 columns that it takes on average and having a separate if end seems illogical. There must be a smart solution to find this kind of average. Help, please.

Thank you
Aristides

Hey,.

SELECT (nvl (col1, 0), nvl (col2, 0), nvl (col3, 0) + nvl (col4, 0)) / (nvl2 (col1, 1, 0) + nvl2 (col2, 1, 0) + nvl2 (col3, 1, 0) + nvl2 (col4, 1, 0))
Table_name FROM

I hope this helps.

-Annick

Tags: Database

Similar Questions

  • Need help finding the product key.

    Here, can anyone help me find the product key of Norton antivirus software that came pre-installed with my hp Pavilion 15' inch laptop notebook pc. I need to update the software and I can't do it without the key.
    Impatient in waiting.

    If the product is installed (Norton _) - it would be better to contact them (Symantec / Norton) support - as it's their product and they will be able to tell you where to look.

    otherwise, you can try third-party products like Belarc Advisor - that should give you said information if it exists on the system.

  • Need help finding the number of occurrences of a model.

    Hi all

    I need help to find the number of occurrences of a model in the column of the table data.

    Consider the examples of data - column of a row in a table:

    'S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C '.

    My requirement is:

    I should get the County of S that are immediately preceded by or P.

    for the above data, I should get are counted as 3 + 2 + 1 = 6 (S-S-S-A, S-S-P, S - A)

    The configuration data is stored as type VARCHAR2.

    Thanks in advance,
    Girish G

    Published by: Girish G on July 21, 2011 23:22

    I don't know that there is a better way, then this one:

    SQL> with dt as
      2  (select 'S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C' str from dual)
      3  SELECT SUM(Regexp_count(Regexp_substr(str, '(S\-?)+(A|P)+', 1,
      4                                     Regexp_count(str, '(S\-?)+(A|P)+') - (
      5                                                  LEVEL - 1 )), 'S')) len
      6  FROM   dt
      7  CONNECT BY LEVEL <= Regexp_count(str, '(S\-?)+(A|P)+')
      8  /
    
           LEN
    ----------
             6
    
  • Need help finding the model number

    Hello

    I have a dell monitor, but what is on the tag is:
    CN0RW1957287282M0HMS
    Rev a01
    I need help so I can get a replacement for it power button Board.

    Thank you

    CN0RW1957287282M0HMS

    Dell RW195 part number = E198WFPF

    Search spare parts on eBay or these 3rd party repair sites and see if they sell components to monitor and have the internal documents of troubleshooting:
    http://www.lcdrepair.com/

    http://www.shopjimmy.com/Dell

  • Need help finding the catalog

    one month there is or if I've lost my LR catalog.  I was in a hurry to deal with certain things so rather that trying to push hard right, then, I just downloaded photos and started a new catalog.  Stupidly, I don't think that I never backed up my catalogue.  I have an OS windows8.  How can I find the old catalog? I clicked on the Lightroom folder in my pictures folder.  When I tried to open it it said that the file was already in use?

    In this case, you must find a file whose name ends with .lock and then delete this file (and only this file, do not delete anything else).

  • Need help finding the right wireless card

    Hello

    I'm trying to find out what wireless network card should I buy for my laptop computer backup HP Pavilion dv4000 (dv4253EA) can someone help with this?

    Hello:

    Your model came with the wireless network card.

    Is there a place to install a wireless card?

    Are there already the antennas in the compartment?

    If this isn't the case, you will need to purchase an external wireless adapter.

    Please see the service manual in Chapter 5 for the location where the wireless card is going.

    http://h10032.www1.HP.com/CTG/manual/c00553278.PDF

    There is also a list of the supported WLAN cards with HP numbers.

    None of them are available for sale to HP, then your best bet is to buy used on eBay.

    Questioned by the HP part only number.

    Only one of the listed cards will work and they also have the HP piece on them or they will not work.

  • Need help finding the touchsmart tm2 touchscreen driver (s). Win7 32 bit

    work on a touchsmart tm2. Number is WQ703UA #ABA

    Just installed the operating system Windows 7 Home Premium 32-bit

    No error message, but not touch either ability.

    A change made to the system: my computer did a fall from a table on the hard ground. The hard drive has been damaged. It worked just well enough to get into the safe mode and copy off all my files. (Thank God!) But I had to buy a new hard drive for it. So I start from scratch. I was not able to locate the touch screen driver that would allow me to interact with my screen.

    Can someone help me to find it and or do this thing fixed? Thank you very much!

    t

    Here are the specifications of your HP tm2-2052nr laptop. According to the specifications, it comes from the factory with Windows 7 Home Premium 64-bit. You must have created a set of HP recovery disks when you set up your computer. These discs would restore the system to a factory like State in a situation like this.

    Drivers for your system are located HERE , but I have not found a 32-bit driver for the touch screen. If you wish to order discs of HP recovery, call or email HP customer care to order.

    If your HP tm2-2052nr was purchased from Microsoft instead of HP, please read THIS.

    Frank

  • NEED HELP FINDING THE SERIAL NUMBER

    Hi, so I bought Adobe Photoshop Lightroom 6 today and I followed all the directions he asked... He never gave me the serial number to advance my installation with lightroom process. He had just created Adobe Cloud. Help me!!

    Hello

    I just checked your account and you have a license of LR6 registered to your account.

    Please check the help below document:

    Quickly find your serial number

    Kind regards

    Sheena

  • Need help finding the serial number or transfer CS5 to new computer.

    I have a new computer and want to move my CS5 software but cannot find my serial number. Other options? I downloaded the version I have, but I do not appear to be registered with adobe, so can't find it like that.

    Lost information - response #1 in https://forums.adobe.com/thread/2008767

  • I need help with the allignment of lines with the pen - CC 2014 Photoshop tool

    Hi guys I have alignment issues. I'm trying to align the lines (pen tool), but there is no possibility to do!

    I have not tried, but I mean when you connect to the last line to make a square, I want to be all straight lines. I'll give your method a go thank you!

  • Hello, need help finding the right part number etc... HP Pavillion G7 series 1316dx

    Hi all

    Last resort was everybody here, I tried to look for the part my own and hope not to lose time everyone.

    I'm looking for the correct number for an LCD Inverter.  My laptop screen keeps going black on me.  I shone a light on this issue and you can still see the screen is not the LCD screen.

    Laptop model:

    Screen 17 "HP Pavillion G7 series 1316dx.

    Thank you.

    HPpavillionguy.

    Your manual, you don't have an LCD with CCFL inverter for the backlight.

    http://h10032.www1.HP.com/CTG/manual/c03538328.PDF

    Page 23 Chapter 3.

    You have a LCD backlit with no LED converter.

    Your room number is.

    641395 001

    http://www.eBay.com/ITM/HP-641395-001-584037-001-641629-001-new-17-3-WXGA-led-LCD-screen-glossy-/171398452425?PT=US_Laptop_Screens_LCD_Panels&hash=item27e824d4c9

    I don't think that we have now. "We have sold about 35 in 2 weeks."

    We sell used for about $45.

    And we have no more listed on Ebay.

    I can check with them in the AM.

    REO

  • Need help finding my code of the original key.  Have the update level but need the original.  Can you help me?

    Need help finding my code of the original key.  Have the update level but need the original.

    How did you come to lose?

  • Need help with the API Explorer

    Hi all

    I am creating a workflow to automate certain tasks of P2V and I want to disconnect the NETWORK adapter prior to anyting on virtual machines. When everything is done, I want reconnect you this NIC I play with vCO for a few months now and I need to get help with the part of the script. I always managed to find a code but this time I did not find anything!

    So I need to script this part! I think I found a way to change the connection settings of the VMXNET3 NETWORK adapter with this part of the code:

    System.getModule("com.vmware.library.vc.vm.spec.config.device").getVirtualVmxnet3(backing,connectable,controllerKey,deviceInfo,key,unitNumber,addressType,macAddress,wakeOnLanEnabled)
    var connectset = new VcVirtualDeviceConnectInfo();
    connectset.connected = false;
    connectset.startConnected = false;
    

    Now, I need to find the way to set these parameters to a VM VMXNET3 adapter?

    How to off the virtual machine to these settings?

    Thanks for your help!

    If you are connected to a distributed switch, they canned for this com.vmware.library.vc.networking.connectVmNicNumberToVirtualDistributedPortgroup action.  If this isn't a vds connect you to, then you need to change then it will have to be slightly modified to use normal NIC instead of vds support.  You will also need to add these lines to the device configuration section:

    devicespec. Device.connectable = new VcVirtualDeviceConnectInfo();

    devicespec. Device.connectable.Connected = true;

    devicespec.device.connectable.startConnected = true;

    I copied this action and added these 3 lines to achieve what it looks like you are trying to do.  We don't really use standard switches in our environment.

    Paul

  • Hello need help with the opacity mask.

    Hello need help with the opacity mask. I hope someone out there can help

    I inherited a logo that appears to use a Logo of OM has a shape with a grad. This grad at first sight is not used in the Grad scheme and there is not editable.  Looking at the transparency palette I find an OM (pic1) output option. If I choose what the grad on separates it from the page of the form, that is from there I can change/remove as required (Note2).

    However, sometimes (he did no change), I'll be back to the same original form and output option is grayed out and is no longer available. Or I go to the similar shape that has the same treatment and I can't go out OM (pic3)

    The only difference is the thumbnail in the transparency palette, which is strong in pic1 and rated on pic3. What Miss me?    I'm not clear what the advantage is simply OM using the Grad palette to apply a grad in my form, but until I can get rid of OM who is there, I can't comfortably apply to the grad I want.

    The white gradient LHS I have no problem with. I choose fortunately only and each time get the possibility of release of OM.

    Screen Shot 2015-08-06 at 12.26.48.pngScreen Shot 2015-08-06 at 12.00.10.pngScreen Shot 2015-08-06 at 12.01.16.png

    The other thing weird. When I select the white gradient. Sometimes, the exit option is in the palette without going through the drop-down list (Fig 4).

    Other times seems not that OM has already been applied, because the palette gives me the ability to mask rather than liberation (5 photos). Until I go to the drop down and then I find Release is an option after all.

    What is the difference here?   Not much of a problem, because either way I can release OM to be able to change the grad.

    The file is passed through several hands and play anywhere to try to resolve issues, and many stops and save slot, so something along the line was of course done a logo and not the other because of the difference, but I can't for the life of me see what that.

    Screen Shot 2015-08-06 at 12.44.21.pngScreen Shot 2015-08-06 at 12.44.36.png

    I hope someone can help. Very appreciated


    See you soon

    Dave

    Dave,

    I've (mis) understanding the issues, you can account for the box to the right in the main palette transparency (called thumbnail) here.

    Illustrator help | Transparency and blending modes

    represents the masking objects.

    Some of your screenshots show no object mask, so it only is not really a mask even if do the opacity mask has been clicked and there seems to be one in the layers palette, wherever you look.

    I think that it is perhaps the issue.

  • I need help, find how to install Windows Vista on a HP Pavilion 6475z disk.

    I need help, find how to install Windows Vista on a HP Pavilion 6475z disk.   I had to replace the hard drive, so he has nothing about it and I added more ram, but I replace the cd player so it is not yet installed on the HP.   So I was wondering if I could put the installation disc in my laptop cd/dvd and connect computers by usb ports and install it this way and if not how can I?

    Thank you

    Hello

    You are welcome

    If the CD/DVD drive in the works of PC Gateway, you can (at least temporarily) remove it and install it in the HP, you can run your recovery disc and reinstall Vista.  Once everything is running on the HP, you can always remove the CD/DVD drive and reinstall it in the gateway PC if you wish.

    Kind regards

    DP - K

Maybe you are looking for

  • MacBook opportunity received; Unable to install OS?

    My old friends MacBook after mine died.  She had already erased the hard drive before giving it to me. I am trying to reinstall the OS (Maverick) so I can start again. But it does not accept my Apple ID? When I enter it and try to install it, I get t

  • timeout downloading update apple. What I have to change and how?

    OK I have no idea what I'm doing. I am trying to download an update for my phone from Apple. It starts but then times out. Where and what settings should I change?

  • Can not turn on pc

    Sometimes when I turn on my pc, it goes with a "beep" sound four times systematically. In this case all day and the next day, everything is back to normal. Can someone answer me why this happens and how to fix this?

  • Router password already filled in, but still access with password standart | MAC-addresses?

    Hello The router password is already filled in, someone else did it for us or it could be standard. But I can still connect with the standart password: admin, what do I do? Second thing: I would like to fill in the addresses-mac, but I have had three

  • BlackBerry Smartphones Blackberry Pearl 8130 voicemail number

    I recently bought this phone (less than 2 months ago), and a week ago I started having bad to retrieve voice messages left on the Blackberry phone.  Note that I am able to retrieve messages from the Blackberry using a landline or another phone. With