Check the number of non zero values in each row

Hello

I have the following table

create the table attbon as

(

Select pryear 2014, 1 empid, to_date('21/11/2014','dd/mm/yyyy') prdate, 12 prmonth, 3 shortleave union double all the

Select double union all the 12 prmonth 2014 pryear, 1 empid, to_date('22/11/2014','dd/mm/yyyy') prdate shortleave 0

Select double union all the 12 prmonth 2014 pryear, 1 empid, to_date('23/11/2014','dd/mm/yyyy') prdate shortleave 0

Select double union all the 12 prmonth 2014 pryear, 1 empid, to_date('24/11/2014','dd/mm/yyyy') prdate shortleave 0

Select double union all the 12 prmonth 2014 pryear, 1 empid, to_date('25/11/2014','dd/mm/yyyy') prdate shortleave 0

Select pryear 2014, 2 empid, to_date('21/11/2014','dd/mm/yyyy') prdate, prmonth 12, 1 shortleave Union double all the

Select 2014 pryear, 2 empid, to_date('22/11/2014','dd/mm/yyyy') prdate, prmonth 12, 1 shortleave Union double all the

Select 2014 pryear, 2 empid, to_date('23/11/2014','dd/mm/yyyy') prdate, prmonth 12, 1 shortleave Union double all the

Select double union all 12 prmonth, 2014 pryear, 2 empid, to_date('24/11/2014','dd/mm/yyyy') prdate shortleave 0

Select double union all 12 prmonth, 2014 pryear, 2 empid, to_date('25/11/2014','dd/mm/yyyy') prdate shortleave 0

Select 3-shortleave, 3-empid, prmonth 12, to_date('21/11/2014','dd/mm/yyyy') prdate, 2014 pryear Union double all the

Select double union all 12 prmonth, 3 empid, to_date('22/11/2014','dd/mm/yyyy') prdate, 2014 pryear, 1 shortleave

Select double union all 12 prmonth, 3 empid, to_date('23/11/2014','dd/mm/yyyy') prdate, 2014 pryear, 0 shortleave

Select double union all 12 prmonth, 3 empid, to_date('24/11/2014','dd/mm/yyyy') prdate, 2014 pryear, 0 shortleave

Select double union all 12 prmonth, 3 empid, to_date('25/11/2014','dd/mm/yyyy') prdate, 2014 pryear, 0 shortleave

Select pryear 2014, empid 4, to_date (' 21/11/2014 ',' dd/mm/yyyy') prdate, prmonth 12, 1 shortleave Union double all the

Select 2014 pryear, 12 prmonth, 3 shortleave, 4 empid, to_date (' 22/11/2014 ',' dd/mm/yyyy') prdate of all the double union

Select double union all 12 prmonth, 2014 pryear, 4 empid, to_date('23/11/2014','dd/mm/yyyy') prdate shortleave 0

Select double union all 12 prmonth, 2014 pryear, 4 empid, to_date('24/11/2014','dd/mm/yyyy') prdate shortleave 0

Select pryear 2014, prmonth 12, shortleave 0, empid, to_date (' 25/11/2014 ',' dd/mm/yyyy') 4 prdate double

);

I want to find the eligibility of premium participation for each employee for each day

An employee is allowed to take the maximum of 3 hours as shortleave.

Normally if SHORTLEAVE is greater than 1 for a day, the employee is not eligible for the bonus of participation for this day

So if an employee DISP shortleave of one hour each, on three different days or more, it is eligible for the bonus of attendance for every day.

If it make use of all three hours on a stretch as he is eligible for the bonus of presence condition no other short-term leave availed for this month.

otherwise this day where it's not eligible for the bonus of presence

That is to say.

attboneligible of a day is 1

If shortleave < = 1

or

(shortleave = 3, and County of short leave zero for the month is 1)

Required result

=============================================

EMPID PRDATE ATTBONELIGIBILITY

=============================================

21/11/2014 1, 1

22/11/2014 1, 1

23/11/2014 1, 1

24/11/2014 1, 1

25/1/11/2014 1

21/11/2014 2, 1

22/11/2014 2, 1

23/11/2014 2, 1

24/11/2014 2, 1

25/2/11/2014 1

3                 21/11/2014                     0

22/11/2014 3, 1

23/11/2014 3, 1

3 24/11/2014 1

25/3/11/2014 1

21/11/2014 4, 1

22/11/2014 4, 0

23/11/2014 4, 1

24/11/2014 4, 1

25/4/11/2014 1

===============================================

I use oracle 10g

Help, please

Hello Krishna,

Try this in your test data:

Update attbon set shortleave = 2 where shortleave = 3;

And compare with your expectations.

I guess, Frank or your own modiifcation will do the job...

If I understand you right...

But try Indra!

Best regards

Karlheinz

Tags: Database

Similar Questions

  • How to check the number of items available in RT FIFO?

    Hello

    Is there a way to check the number of items in RT FIFO without using READ FIFO function? I'm looking for a function like the function of status get queue VI.

    Thank you very much!

    Kind regards

    Tom

    See this KB article

    http://digital.NI.com/public.nsf/allkb/42E85A333767918B862570D800667FD8?OpenDocument

  • How can I check the number of pixels in my image of the camera? [was: Pixels]

    How can I check the number of pixels in my image of the camera?

    Open a file

    Select > all

    Choose the histogram and click in the upper right

    Choose expanded view

    The number of pixels note

  • Check the number of continuous Page in the Document

    Hi all

    It is possble to check the number of continuous page in the active document.

    Problem is due to the use of several "number and Sections options" in the control panel pages F12.

    No error: alert ("Pass")

    If an error in the sequence of folio: alert ("Fail")

    Could someone please help for my application.

    Currently replace all elements of the master page by using the following script

    main();
     function main() {
        var doc = app.activeDocument,
            i, l, page, j;
            
        for (i = 0; i<  doc.pages.length; ++) {
            page = doc.pages[i];
            if (page.appliedMaster !== null) {
                for (j = 0; j< page.appliedMaster.pageItems.length; j++) {
                    try {
                        page.appliedMaster.pageItems[j].override(page);
                    } catch(e) {}
                }
            }
            page.pageItems.everyItem().detach();    
        }
    }
    
    

    Thanks in advance

    Beginner_X

    Check the code below

    main();

    main() {} function

    var doc = app.activeDocument,

    i, l, page, j;

    pageNumber = 0;

    for (i = 0; i<  doc.pages.length;="" i++)="">

    page = doc.pages [i];

    pageNumber ++

    Alert (page.name)

    If {(page.name is pageNumber)

    Alert ('pass')

    }

    else {}

    page.name = pageNumber

    Alert ("fail")

    }

    }

    }

  • to check the number of rows affected by an update query in a procedure

    Hello
    I want to check the number of rows affected by the update script that I used in a procedure and I shoud be able to use this count towards the end of the procedure.
    How can I do?

    for example:
    create or replace procedure p1 is
    Start
    Update table1 set x = 'a', where y = 'b ';.
    end p1;

    Published by: christele CS on May 1, 2012 22:06

    Hello

    Try the below a...

    create or replace procedure p1 is
    Start
    Update table1 set x = 'a', where y = 'b ';.
    dbms_output.put_line (SQL % ROWCOUNT |) ("Lines updated ');
    end p1;

  • How to check the number of colors in the file?

    How to check the number of colors in the AI file?

    :-)

    Redefine the tool will list all the colors used in a document and the context menu in the swatches Panel also provides tools for color management.

    Mylenium

  • How to check the number of "empty" field

    Hello world

    I describe the situation as a first step:

    • I work with WCC 11.1.1.5
    • I have workflows 5 steps.
    • Users can change the values of the attributes of document at each stage.
    • I managed the attribute is required in each step by rules. The attributes are not defined as ' required value: required ' by attribute definition. It is done by the definition of the rule.


    What I do:

    Check that one attribute (called xInv_SAP_document_line) has been filled in by the user in the third step of the workflow. This attribute is of type 'Integer '.


    What is my problem:

    Whenever the system performs the update of sending it automatically fills the number 0 for all integer attributes.

    When the user fills out a "xDepartment" attribute in the first stage, the system to insert a value of 0 for the attribute 'xInv_SAP_document_line '.

    I'm not able to verify if the user filled in the "xInv_SAP_document_line" attribute in the third step, because the value 0 is already there from the first step. It has no effect if the attribute is 'Required' - it has value = it's OK. But I need a control that the user fills out. Not the system.


    What I tried:

    'Use the default' check the box help doesn´t rule field. It only works for empty values.

    I can change the value of "derived field" checkbox in the second stage. But I'm not able to erase the value - what is the behavior I need.


    Is it possible to remedy this situation?


    Thanks for any advice,

    Mike




    Integer fields, once submitted, will be filled with 0 when the element is submitted and the field is empty.  It's the way integer fields work in Content Server - I've not seen a way to change this behavior.

    If 0 is never going to be a valid value, in the article "side effects" of the rule, add the following code and see if it solves your problem.

    <$if #active.xinv_sap_document_line="=" 0$="">

    <$dpPromote("xInv_SAP_document_line","")$>

    <$endif$>

  • Replace the empty column with ZERO values

    Hi experts,

    I'm building a report to display the number of orders per channel / day / hour.

    Since a few days one or several channels may not all orders placed against them in which case my report shows empty values in the report.

    Ideally, I would have zero in these columns rather than an empty cell.

    Sample Qry: -.

    Select
    Channel,
    Count (order_num) County
    Of
    SALES_ORDER

    Pls help!


    Thanks in advance.

    Count always returns 0 if no line found or the actual number based on the found rows. You don't even have to NVL them. I think so
    the problem is in your report layout, in my opinion.

    You run query sqlplus, or Toad or sqldevloper and you can see for yourself that the count is 0.

    See you soon.
    VIN.

  • How to check the number of servers, a unique summer migrated database?

    Is it possible to check the information of the previous server where the database has been migrated.

    Ajay Vijayan wrote:

    The binaries have been transferred from the old server and grid has been installed in the new ASM migration server.

    Alert log is purged according to police.

    Ajay

    1. logically, it can not be followed from the point of view of database. Since when we migrated to new server we can just copy the data files and take the help of rman and migrate (hope you are aware)

    2. If we are not reset all the newspapers during the process, if we do it due to a problem we knew that the level of incarnation (date/time)

    3 database does not take care of these information

    4. perhaps there is an alternative, you can get it from 'DBA_HIST_DATABASE_INSTANCE '.

    that keeps INSTANCE_NAME and HOST_NAME... .When you database runs from host A for 6 months and then you moved to server 'B '.

    5 to start and next stop he will track this new server (provided during migration if you have made a rebound at this time, then you can have alteast moving day)

    6. IF you are looking for server then in the course of the interview you can bounce while patching so separate hostname is able to follow

    -Note - rest depends on the number of records that he takes for his life

    It may be useful

    -Pavan Kumar N

  • How to check the page dirty with default values existing in viewObject?

    Hi all

    I use JDeveloper 11.1.1.4.

    I have two pages in my application. I am browsing for page2 page1.

    Before opening page 2 I created new line page 2 notice of object using method 'Create Insert()' with some default values by using the ViewRowImpl class.

    My problem is that I have a button to return to Page 2. If I click the back button, then check the Application module is dirty or not.

    But it always shows AM is dirty due to I'm setting some default values in ViewRowImpl. If I avoid the default values in ViewRowImpl then AM dirty check works fine.

    My Question is how to check the AM (or) dirty Page with default values in the object view?

    My bean Codes:

    Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DataControl dc = bindings.findDataControl("AppModuleDataControl");

    ApplicationModuleImpl am = ((ApplicationModuleImpl) dc.getDataProvider ());

    If (am.getDBTransaction (.isDirty (()))

    {

    return "Page is dirty."

    }

    My Jspx Codes:

    < af:commandLink id = "cl6" text = '2 '.
    shortDesc = "Add Row in Page2"
    actionListener = "#{bindings." Action CreateInsert.execute}' = 'Edit' >

    Thank you

    David...

    see this

    http://www.techartifact.com/blogs/2013/11/how-to-check-ifdirty-is-modified-for-view-object.html

    http://www.jobinesh.com/2011/05/checking-for-dirty-data.html

  • Check the number of days in the free trial is left

    Where can I go to see exactly how much Adobe Creative Cloud is remaining days of a free trial of any software?  It is in the creative cloud?  It is somewhere in the software that I have installed the trial of?  Where can I see the number of remaining days?

    Check the installation of your executable file for the program of the trial date.

  • Check the number of users and security

    Gurus,
    In our EPM (System 11.1.2) environment, we have four applications/databases (planning and essbase included) and I need to list the total number of users in all applications and see what he put in service and security are. How I might be able to do?
    Do I need security on each of them for export and filter or is it possible to check the users in all applications at the same time?
    Thank you

    departure from Hyperion wrote:
    Thanks for your reply Celvin
    Is there a way I can view a list of users by Department?
    Y at - it something like that to sort by Department/Group.
    Thank you

    List of users by Department - there are groups of Shared Services, are your groups classified by Department? If the answer to this is 'Yes', then Yes, the export of all shared Services groups will track children (members) in each group.

    I don't think that there is some kind of Shared Services, but once the csv file is exported, you can sort it out.

  • Check the number and size of the partitions on VMware ESX

    As I am not responsible of the ESX host facilities, but will be responsible for the final ESX cluster I would check the configured partitions configured by our Tec facility to ensure that all hosts are configured correctly.

    Does anyone know of a CLI command to view the partitions (points of size and editing) of an ESX host.

    Paul

    P.S. I've tried using the df - h command, but I'm only displays a limited number of partitions, i.e.; / Boot and/var/log

    Evening,

    VDH h will show you all partitions, including those controlled by the VMKernel.

    Thank you

    Glen

  • check the number of

    Dear all,
    I want to check that a string 5 is the number.


    SELECT h.dcn_debit_credit_note_no, substr(h.dcn_debit_credit_note_no,4,1)
    OF t_debit_credit_note: WHERE
    substr (h.dcn_debit_credit_note_no, 4, 1) =?

    A help

    Hello
    Something like that

    ...
    substr(h.dcn_debit_credit_note_no,5,1)  between '0' and '9'
    
  • Check the number of payments AP

    How to set the current verification number that prints when I use the "payment of format" during the processing of a batch of payment?

    Check starting number > end sequence stored in the Bank - sign in as Manager of accounts payable > query Bank > bank accounts > query counts use "Internal" > apply Documents

Maybe you are looking for