Convert dates running in date ranges

Good morning/afternoon/evening experts!

Oracle - Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Version

I have data like below

Location & Date the number of employees in the absence of Vice

DEPT_ID DAILY_DATE POSITION ABSENT_EMP

------------------------------------------------------------

1981 13 OCTOBER 2015 HR EXEC 1

1981 14 OCTOBER 2015 MARKETING 2

1981 15 OCTOBER 2015 MARKETING 2

1981 15 OCTOBER 2015 ADMIN 2

1981 16 OCTOBER 2015 HR EXEC 1

1981 16 OCTOBER 2015 MARKETING 1

1981 17 OCTOBER 2015 MARKETING 1

1981 17 OCTOBER 2015 ADMIN 2

1981 18 OCTOBER 2015 MARKETING 3

1981 18 OCTOBER 2015 HR EXEC 1

1981 18 OCTOBER 2015 ADMIN 2

-------------------------------------------------------------

-Please note that if any employee is absent there is no line for this date

Expected - result

DEPT_ID, START_DATE END_DATE POSITION ABSENT_EMP

--------------------------------------------------------------------

1981 OCTOBER 13, 2015 18 OCTOBER 2015 1 HR EXEC

1981 OCTOBER 15 OCTOBER 14, 2015 2015 MARKETING 2

1981 OCTOBER 17 OCTOBER 16, 2015 2015 MARKETING 1

1981 OCTOBER 18, 2015 18 OCTOBER 2015 MARKETING 3

1981 OCTOBER 15, 2015 15 OCTOBER 2015 ADMIN 2

1981 OCTOBER 18 OCTOBER 17, 2015 2015 ADMIN 2

--------------------------------------------------------------------

Thanks in advance!

Looks like a job for: 101 PL/SQL: grouping sequence ranges (method Tabibitosan)

Tags: Database

Similar Questions

  • Filter by date range table

    I use JDev 11.1.1.6

    I'm following Frank worm detailed information on how to filter the ADF tables by date range. The link is below.


    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/59-table-filter-by-data-range-176653.PDF


    I have 2 problems that I deal. They are:

    (1.) the datapicker for both filters are not make the date picker when I click on it. As I said I use 11.1.1.6 which I think should work. Note to Frank says he did not before 11.1.1.6. I can manually enter the date ranges and the filter works.
    2.) when I filter by my date or any other filter on the page, the filter returns the data that I expect to be back. For some reason the date filter is more restores. It's as if the entire filter facet disappears. I suspect it is because I do something wrong in the bean support. I posted this code below.

    Let me know if you have thoughts about what I might get hurt.


    {} public void onQuery (QueryEvent pQueryEvent)
    ArrayList < object > lAuditCodeArray = null;
    FilterableQueryDescriptor = lFilterableQueryDescriptor
    (FilterableQueryDescriptor) pQueryEvent.getDescriptor ();
    as submitted by the user such current filter criteria
    Map lCriteriaMap = lFilterableQueryDescriptor.getFilterCriteria ();

    The method links to set on the access ViewCriteria bind variables.
    OperationBinding = lRangeStartOperationBinding
    getBindings () .getOperationBinding ("setAuditDateRangeStart");
    OperationBinding = lRangeEndOperationBinding
    getBindings () .getOperationBinding ("setAuditDateRangeEnd");
    Object lAuditDateStartRange = lCriteriaMap.get ("AuditDateStartRange");
    Object lAuditDateEndRange = lCriteriaMap.get ("AuditDateEndRange");
    lRangeStartOperationBinding.getParamsMap () .put ("value",
    lAuditDateStartRange);
    lRangeEndOperationBinding.getParamsMap () .put ("value",
    lAuditDateEndRange);
    lCriteriaMap.remove ("AuditDateStartRange");
    lCriteriaMap.remove ("AuditDateEndRange");
    lRangeStartOperationBinding.execute ();
    lRangeEndOperationBinding.execute ();


    lFilterableQueryDescriptor.setFilterCriteria (lCriteriaMap);

    run the default QueryListener code added by JDeveloper
    ADFUtil.invokeMethodExpression ("#{bindings.") Audit2Query.processQuery} «»
    Object.Class, QueryEvent.class,
    pQueryEvent);


    filter of restoration carried out by the user selection
    llCriteriaMap.put ("AuditDateStartRange", lAuditDateStartRange);
    lCriteriaMap.put ("AuditDateEndRange", lAuditDateEndRange);
    lFilterableQueryDescriptor.setFilterCriteria (lCriteriaMap);
    }



    Here's the column I'm filtering where it's useful.


    < af:column sortProperty = "CrtdDttm" sortable = "true".
    headerText = "Date".
    ID = "crtDate" align = "center" width = "260".
    filterable = "true" >
    < f: facet = name 'filter' >
    < af:panelGroupLayout id = "pgl1" layout = "horizontal" >
    < af:panelLabelAndMessage label = "" to: ""
    ID = "plam1" >
    < af:inputDate id = "id1".
    value = "#{vs.filterCriteria.AuditDateStartRange} '"
    clientComponent = "false" >
    < af:convertDateTime pattern = "#{bindings." CsgAudit2.hints.CrtdDttm.format}"/ >
    < f: validator binding = "#{bindings." CrtdDttm.validator} "/ >"
    < / af:inputDate >
    < / af:panelLabelAndMessage >
    < af:spacer width = "5" height = "5".
    ID = "s5" / >
    < af:panelLabelAndMessage label = "" to: ""
    ID = "plam2" >
    < af:inputDate id = "id2".
    required value = "#{vs.filterCriteria.AuditDateEndRange}" = 'false' "
    clientComponent = "false" >
    < f: validator binding = "#{bindings." CrtdDttm.validator} "/ >"
    < af:convertDateTime pattern = "#{bindings." CsgAudit2.hints.CrtdDttm.format}"/ >
    < / af:inputDate >
    < / af:panelLabelAndMessage >
    < / af:panelGroupLayout >
    < / f: facet >
    < af:inputDate value = "#{row.bindings.CrtdDttm.inputValue} '"
    required = "#{bindings." CsgAudit2.hints.CrtdDttm.mandatory}.
    shortDesc = "#{bindings." CsgAudit2.hints.CrtdDttm.tooltip}.
    ID = "id3" readOnly = "true" >
    < f: validator binding="#{row.bindings.CrtdDttm.validator}"/ >
    < af:convertDateTime pattern = "#{bindings." CsgAudit2.hints.CrtdDttm.format}"/ >
    < / af:inputDate >
    < / af:column >

    Can you try to remove the validator and convert date time to the side of the filter and check.
    I had a similar problem with my custom filter and the filter facet did not. I discovered that it was because I had created a property my filter component (selectonechoice) bean binding.
    I used version Jdev 11.1.1.4.

    Thank you
    Rakesh

  • TestStand database error - error converting data from nchar int type.

    Hello

    I used SQL standards database stored procedure options to store records of my test and I added the generated tables and stored procedures in a database and it seems to work OK in this form. However when I change the UUT_Results table to include a new column that contains the value of the primary key of another table in the database that I meet problems.

    I run a query that returns the primary key value (integer) for a given series number and stores the result as a global station (number format). The correct value is stored in the variable, but when I try to use this value in the stored procedure I get an error like below:

    An error occurred calling "LogResults" in "ITSDBLog" of "ZNIUGOL TestStand database logging"
    An error has occurred by executing a statement.
    Schema: SQL Server Stored Proc (NOR)
    Statement: UUT_RESULT.
    Description: Error converting data from nchar int type.
    Number:-2147217913
    NativeError: 8114
    SQLState: 22018
    Reported by: provider Microsoft OLE DB for SQL Server

    Source: TSDBLog

    My SQL statement for creating the table and the procedure for UUT_results are below:

    ~
    CREATE TABLE UUT_RESULT)
    Uniqueidentifier PRIMARY KEY ID,
    BoardDetailID int,
    STATION_ID varchar (255),
    BATCH_SERIAL_NUMBER varchar (255),
    TEST_SOCKET_INDEX int,
    UUT_SERIAL_NUMBER varchar (255),
    USER_LOGIN_NAME varchar (255),
    START_DATE_TIME is datetime,
    EXECUTION_TIME float,
    UUT_STATUS varchar (32),
    UUT_ERROR_CODE int,
    UUT_ERROR_MESSAGE varchar (255)
    CONSTRAINT UUT_RESULT_FK FOREIGN KEY (BoardDetailID) made REFERENCE BoardDetails)

    ~
    CREATE PROCEDURE InsertUUTRESULT
    @pID uniqueidentifier,
    @pBoardDetailID int,
    @pSTATION_ID varchar (255),
    @pBATCH_SERIAL_NUMBER varchar (255),
    @pTEST_SOCKET_INDEX int,
    @pUUT_SERIAL_NUMBER varchar (255),
    @pUSER_LOGIN_NAME varchar (255),
    DateTime @pSTART_DATE_TIME.
    float of @pEXECUTION_TIME.
    @pUUT_STATUS varchar (32),
    @pUUT_ERROR_CODE int,
    @pUUT_ERROR_MESSAGE varchar (255)
    AS
    INSERT INTO UUT_RESULT (ID, BoardDetailID, STATION_ID, BATCH_SERIAL_NUMBER, TEST_SOCKET_INDEX, UUT_SERIAL_NUMBER, USER_LOGIN_NAME, START_DATE_TIME, EXECUTION_TIME, UUT_STATUS, UUT_ERROR_CODE, UUT_ERROR_MESSAGE)
    VALUES)
    @pID,
    @pBoardDetailID,
    @pSTATION_ID,.
    @pBATCH_SERIAL_NUMBER,.
    @pTEST_SOCKET_INDEX,.
    @pUUT_SERIAL_NUMBER,.
    @pUSER_LOGIN_NAME,.
    @pSTART_DATE_TIME,.
    @pEXECUTION_TIME,.
    @pUUT_STATUS,.
    @pUUT_ERROR_CODE,.
    @pUUT_ERROR_MESSAGE)

    Any help would be appreciated,

    Thank you

    Stuart

    Stuart-

    What is the expression you are evaluating and the data type of the parameter that you defined in the Options database dialog box for the schema that you connect to data with?

  • Windows Backup & restore leaves gaps in the backup period date ranges

    I noticed that backup & restore leaves gaps in the date ranges displayed on the screen of backup periods under the function to manage the space.  This means that files change during the interval periods have not been saved?  For example, the screen shows currently backups and the following periods:

    Jan 26: 12-18 Mar, 12 GB 10.40

    Apr 04, 12-13 Apr, 12 GB 19.62

    27 April, 12-27 Apr, 12 GB 05.16

    May 06,12 - May 06,12 02.41 GB

    May 27.12 - 17 Jun, 12 GB 03.41

    What is the importance of gaps?

    How can I tell that B & R is fully backup all files that changed since the last backup run?

    How can I varify the 1st backup is a backup full?

    How can I varify that the system image backup is up-to-date?

    I save approximately once a week to a USB external hard drive. I use options "Include a system image" and "Let me choose" to select the files and have selected the option 'keep only the last frame system & minimize the space used '.

    Hello

    Backups are created in sets called backup periods. To maximize your disk space, Windows backup backup all folders selected, the first time it's run and then it only backs up files that are new or have been modified since the last backup was made. Periodically, Windows creates a new, full backup. Each full backup is called in a backup. When you view your backups of files, you can see all the backup periods with date ranges. If you decide to delete backups of files, you should always keep the most recent backup of the file.

    Reference:

    Should what backup settings I use to maximize my disk space? http://Windows.Microsoft.com/en-us/Windows7/what-backup-settings-should-I-use-to-maximize-my-disk-space

    Back up and restore: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/products/features/backup-and-restore

  • convert date format period

    Hi all

    Here are my existing query which I run another tool to extract data from oracle-

    Select * from transactionTbl

    WHERE

    DATE > = TO_DATE (' $(vAppStartDate)', "DD/MM/YYYY")

    AND DATE < = TO_DATE (' $(vAppEndDate)', "DD/MM/YYYY")

    variables-

    -vAppStartDate = 06/01/2014

    -vAppEndDate = 30/06/2015

    Rather than use the Date column in the WHERE condition, I want to use PeriodID of column existing in the same table, to make the query faster.

    The period column is in below format.

    PeriodID format-> 201294 //means 2012Q 4. So 9 means Q

    Since I'm on variables, the values are always to the date format, so my requirement is first change variable date from periods of format.

    I wrote the pseudo-code, because I of course know how to convert date format periodID. Q also means in the periodID 9.

    Select * from transactionTbl

    WHERE

    PeriodID > = period_function (TO_DATE (July 1, 14 ',' DD/MM/YYYY '), 'YYYYxx')

    AND PeriodID > = period_function (TO_DATE (July 1, 15 ',' DD/MM/YYYY '), 'YYYYxx')

    Please help me with the query.

    Thank you!

    Calling a user-defined function is likely to slow down your query.

    What's the problem with just using regular date formatting strings for example

    SQL > select to_char (to_date('15/09/2014','DD/MM/YYYY'), 'YYYY "9" Q') of double;
    TO_CHA
    ------
    201493

    1 selected line.

  • Date range prompt--Null default value

    Hello

    It is a follow-up on post Date invites default NULL

    I have a similar case but using database directly request the report and have implemented a variable presentation with two date ranges. I want to leave the default value of the date white values in the dash prompt, but have the ability to enter values in the other guests and ignore the date of the application

    I have 4 variables of presentation being placed in the SQL query, two of which are the date ranges (between)

    I use OBIEE 10.3.1.4, is there a workaround to run the report using the other prompt values and ignoring the date values null?

    Hello

    Keep your 1900 filter in report itself and no default value chosen at the prompt. If this value is not visible in the dashboard and it will fly too when the user selects a value from the command prompt.

    Thank you

    AJ

  • Date range search

    Hello
    Filtering data for a specific date range does not give the desired result. Currently, the column is a column varchar2.

    Then under query should display the records only 2 for the range of data between 01/01/2013, but his displays all records. Please notify.

    Sample data:


    create table Records_test (B_Recorded_Date VARCHAR2 (4000 BYTE))

    insert into Records_test values('12/04/2013');
    insert into Records_test values('7/25/2000');
    insert into Records_test values('10/30/2003');
    insert into Records_test values('9/5/2006');
    insert into Records_test values('12/5/1994');
    insert into Records_test values('12/19/2013');
    insert into Records_test values('9/4/1992');
    insert into Records_test values('8/7/2007');
    insert into Records_test values('9/28/2005');
    insert into Records_test values('12/10/2004');
    insert into Records_test values('11/28/2011');

    Select * from Records_test
    where
    (
    TO_CHAR (TO_date (substr (B_Recorded_Date, 0, 10), ' MM/DD/YYYY'), ' MM/DD/YYYY') > = to_char (to_date('07/01/2013','MM/DD/YYYY'), ' MM/DD/YYYY')
    and to_char (TO_date (substr (B_Recorded_Date, 0, 10), ' MM/DD/YYYY'), ' MM/DD/YYYY') < to_char (to_date('12/31/2013','MM/DD/YYYY'), ' MM/DD/YYYY')
    )

    04/12/2013
    25/07/2000
    30/10/2003
    05/09/2006
    05/12/1994
    19/12/2013
    04/09/1992
    08/07/2007
    28/09/2005
    10/12/2004
    28/11/2011

    Thank you.

    Hello user7988

    Try this:

    SELECT *.

    OF Records_test

    WHERE

    TO_date (substr (B_Recorded_Date, 0, 10), ' MM/DD/YYYY') > = TO_DATE('07/01/2013','MM/DD/YYYY')

    AND TO_date (substr (B_Recorded_Date, 0, 10), ' MM/DD/YYYY')<>

    ;

    The best way if you set this column as DATE, then there is no need to convert your varchar value date.

    Kind regards
    David

  • convert date in words

    I want to convert date in words
    example: 27-mar-2013 to 27 March twenty thirteen


    running version
    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> SELECT REPLACE (TO_CHAR (TO_DATE ('25-Mar-2013', 'dd-mm-yyyy'),'fmddspth month year'),'-',' ') spdt FROM DUAL;
    
    SPDT
    -------------------------------------------------------------------
    twenty fifth march twenty thirteen
    
    SQL> SELECT REPLACE (TO_CHAR (sysdate,'FMDdspth Month Year'),'-',' ') spdt FROM DUAL;
    
    SPDT
    -------------------------------------------------------------------
    Thirtieth May Twenty Thirteen
    
  • How to pass the date range as in URL filter go

    Hello

    I am trying to build a Url go that has two filters, date range & text. I built the url below, but he continues to throw an error. The url is not from the date max and the app starts following error:

    Error: Status: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 46048] Month DateTime value 0 0000-00-00 is off limits. (HY000)

    Go to Url: https:companyUrl? GB & Options = rfd & Path = / shared/CompanyID/link & P0 = 2 & P1 = eq & P2=CustomObject4.%22Indexed%20Pick%201%22 & P3 = Leasing & bet = P4 & P5 = ""-CustomObject4 Custom Attributes '. " ZDate_26 & P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'


    Please suggest.

    Thank you
    Kiran.

    It seems that you convert the data type of char to date in the URL, I don't think that this is possible.
    Your code is like
    & P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'

    It suppose to be & P6 = 2 + 2014-08-01 + 2014-12-31

    I suggest doing the formatting for this filed using column properties and try.

    Hope this help, pls mark if yes ;)

  • To add totals in a certain date range

    I have 3 sheets. Income, expenses and then an annual journal (has twelve columns, one for each month). Is there a way to get the numbers to add totals to a column of the spreadsheet of spending within the date range 01/01/16 and 31/01/16 and put the total in a cell in January on my sheet of each year. I can't understand a formula so that it can find the date range. I get a synyax error message.

    Assumptions:

    Your TABLES (not the leaves) are named income, spending and summary. Here is any other tables in the document with these names.

    Dates of expenditure are in column A of the table expenses. Other than the header line, all the entries in this column are values Date and time that have been entered as dates only.

    The amount for each item of expenditure is in column C of the expense table.

    Line 1 of the analytical table is defined as a header line.

    January is in column A of the summary table.

    Summary::A1 cell contains the date January 1, 2016, but can be formatted to display only the name of the month or the month and year. (but see the note below) *.

    Enter the formula in the cell that will contain total expenditures recorded with dates in January 2016 below:

    = SUMIFS ("Expenses: Expenses, $C: $A," > = "& A1, Expenses: $A," < = "& EOMONTH(A1,0))

    Example: All the amounts of expenditure were reduced to 1.00 simple confirmation of funds.

    * NOTE: The formula has previously worked with the format of the cells in the row 1 Summary defined to show only the month and the year (two digits) of the effective date values (the first day of the month indicated), but the table I built tonight January 1, 2015 to the format to display 16 Jan, one was interpreted as January 16 (2016) , and SUMIFS formula did not include not January 1 to January 14 numbers in January total.

    A custom, displaying the month (short or long) and the year (four digits) or a custom format shows only the name of the month (short or long) gave good results.

    Note that any format under control of the display, the effective date is the first of the month displayed.

    Table built and tested in Numbers ' 09 (v 2.3)

    Kind regards

    Barry

  • Conditional formatting depends on the date ranges

    Basically, I want to be able to enter a date in column A and a sum of money in the B column, depending on where the date in column A grave in a date range, I want the money in column B to copy to a corresponding column. Is this possible? The only questions I found on here deal in a conditional formatting with dates have to do with derivative.

    Thank you

    Julio

    I hope this help to clarify for you...

    It is not bringing conditional formatting.  Formatting conditional would change the format of a cell (or cells)... as the font, color, size, color cell background, or other formatting character is tics of a cell based on the contents of the cell

    You ask about including of the value of a cel another beach under certain conditions

    Here is an example:

    The first three rows are header lines.

    You must enter a valid date for the towing job.  Using the format "mm/dd/yyyy".

    C4 = IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")

    It's shorthand dethrone select cell C4, and type (or copy and paste it here) the formula:

    = IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")

    Select the cell C4, copy

    Select cells C4 at the end of the C column, paste

  • Smart album by date range does not select all the pictures, it should.

    I created a Smart Album with a range of the year.

    Some pictures appear in the Smart Album, but others do not, even though their information shows that their date corresponds to the range.

    I tried a repair of the photo library database, but that did not help.

    Try breaking the rule of date range: a buggy behavior reported in some language settings.

    This version shows more photos?

  • The smart Albums based on the date range cause app Crash Photos

    While I'm setting up a new Smart Album based on day of photos between 12/01/2015 and 31/12/2015 the Photos app closes with a crash. Cannot set the second date (the end date for this album). However, I can easily create a new Smart Album for next month (01/01/2016 and 01/31/2016). I create smart Albums, because the new Photos app does not like the old iPhoto does with my Photos from the photo gallery.

    How can I solve this? I don't have an album of December...? !

    You are in an area where the date format is different from the United States?  Earlier this year, we have seen small business issues have reported that rules for smart albums date range do not work with the primary language set to French or German.

    Try to change the primary system language to English with an English date format. Photos could be trying to read the 12/31/2015 as the 12th day of the month 31.

    Or use a different date based on 'before' rule and after.

  • Date range of family security

    Yesterday morning, I was able to select the day I wanted to see, but I checked and noticed an updated with no date range in the afternoon.  I want to keep track of that which is seen day after day, not a week.  Help?

    Hello

    Thanks for posting your query on the Microsoft Community.

    We understand that you want to track Web activity report in parental control
    on a daily basis. However, currently, the family safety activity reports Web can
    show only on a weekly basis.

    If you think that the display of the activity report on the Web on a daily basis is a great
    to have the option, you can submit Microsoft using the link below.
    https://Windows.uservoice.com/forums/265757-Windows-feature-suggestions

    Thank you.

  • HOW CAN I SORT MICROSOFT MONEY BY A DATE RANGE?

    I have Microsoft Money 2007 on my computer and I am trying to sort all of my information by date range. Janrary 2009 - January 2010, how do I do that?

    Hello

    Please repost in the silver forum

    Use this forum to discuss Microsoft Money. This includes money, more and more older versions.

    http://social.Microsoft.com/forums/en/money/threads

  • How to increase the available on report date range

    Hi gurus,

    On the BigBrother report page, we can define the date range considered. The date start and end on our BigBrother cannot be defined until 2010 (see this screen below). How can I report for 2012 and beyond?

    Any help will be very appreciated!

    Michael

    Micheal,

    Here's how I did it.

    I have the latest version for free.

    Modify the [BBHOME]/www/help/bb-rep.html file

    Line 95:

    And also to line 153:

    I hope this helps!

Maybe you are looking for

  • Qosmio F50 - 10G drivers for Windows xp?

    Hello everyone I had a few problems with windows vista and games, I get a lot of delays when playing warcraft III in any case, I want to ask you for the Qosmio F50 - 10G drivers for XP Can I get them? Thanks for reading

  • Closing references

    It is necessary to close a command tree explicit reference? The following code is from the finder example - tree Cross and Set Custom Symbols.vi.

  • New Windows XP installation

    I installed a new motherboard in my computer and do work I had to do a fresh install. I had to slipstream sata drivers and now I get an error saying that the activation code is not valid. The code works when I use my drive, origanal but nt with slips

  • How can I fix my window 8 blurry

    When I go to the store window or something its blur. I don't know how do the go fuzzy far any help pleas!

  • Error while loading data in Planning

    Failed to load the data in the planning of the 11.1.2.3.200 using ODI 11.1.1.7Please find the errors at the bottom of newspapers:INFO [SimpleAsyncTaskExecutor-2]: Oracle Data Integrator adapter for Hyperion PlanningINFO [SimpleAsyncTaskExecutor-2]: C