Dates of Split on quarterly basis

I have a requirement in which I divide the dates in the quarterfinals. It should start from the continuous first_date on the last day of the quarterly month and end at last_date.

() AS T

SELECT TO_DATE (' 02/03/2012 ',' DD/MM/YYYY') FIRST_DATE, TO_DATE('26/05/2013','DD/MM/YYYY') DOUBLE LAST_DATE)

SELECT * FROM T

The quarterly result of split I want should look like this-

FIRST_DATE LAST_DATE

02/03/2012-30/06/2012

01/07/2012-31/10/2012

01/11/2012-28/02/2014

01/03/2014 26/05/2013

Thank you

Just like that.

() AS T

SELECT TO_DATE (' 02/03/2012 ',' DD/MM/YYYY') FIRST_DATE, TO_DATE('26/05/2013','DD/MM/YYYY') DOUBLE LAST_DATE)

SELECT CASE WHEN LEVEL = 1

THEN FIRST_DATE

OF ANOTHER LAST_DAY (ADD_MONTHS (TRUNC (FIRST_DATE, 'MONTH'), ((LEVEL-1) * 4)-1)) + 1 END AS FIRST_DATE,.

BOX WHEN LEVEL! = (SELECT MAX (LEVEL) FROM CONNECT BY LEVEL)<=>

THEN LAST_DAY (ADD_MONTHS (TRUNC (FIRST_DATE, 'MONTH'),(LEVEL*4)-1))

OF ANOTHER LAST_DATE END AS LAST_DATE

T

CONNECT BY LEVEL<=>

OUTPUT:

FIRST_DAT LAST_DATE

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

MARCH 2, 12 JUNE 30, 12

JULY 1, 12 OCTOBER 31, 12

NOVEMBER 1ST, 12 FEBRUARY 28, 13

MARCH 1ST, 13 26 MAY 13

Tags: Database

Similar Questions

  • ID CC2015 (MacOSX 10.9.5) data merge splitting script - "data are out of reach,"... for the first 99 records?

    Hi all.

    Scripter Hans Haesler has created a script that I'm sure that a lot of people involved in the merger of data would consider a 'must - have' - the ability to individually named indesign files merging data records (create hyperlinks with script, without a large increase in size and treatment of the BP reqs resulting?). It has improved this script by adding the ability to change the name of the files to the results of a particular field in a database (http://www.hilfdirselbst.ch/foren/INDesign_Script_f%FCr_Datenzusammenf%FChrung_P513807.htm l).

    I took his script and does four things to him:

    • CSV splitter now a tab rather than a comma (to use text files delimited by tabs, rather than the files variables separated by a comma);
    • Fixed to be cross-platform CheminDossierCible (wasn't working properly on my mac);
    • fixed a catastrophic bug that could use the assignment information from file names text referenced in the open file dialog box, but the merger of another data base that has been already linked in the file, so added myDoc.dataMergeProperties.selectDataSource(csvFile,) to ensure that myDoc uses the same data file that is called by the File.openDialog;
    • rather than exporting an InDesign file, this operation exports a PDF preset.
    var fileNameColumn = 1;//Insert here the column number in the CSV of the new file name is specified. 
    var csvSeparator = '\t'//Please here the separator of CSV file Enter 
    var destFolderPath = Folder.selectDialog('Destination Folder for PDF files').fsName + '/' ; 
    var csvFile = File.openDialog('select CSV file'); 
    
    //CSV import 
    var fileNames = new Array(); 
    csvFile.open('r'); 
    while (!csvFile.eof) { 
       fileNames.push(csvFile.readln().split(csvSeparator)[fileNameColumn-1]); 
       } 
    csvFile.close(); 
    
    var myDoc = app.activeDocument;//prepared document  
    myDoc.dataMergeProperties.selectDataSource(csvFile,);
    myDoc.dataMergeOptions.removeBlankLines = true;
      
    var maxRange =  myDoc.dataMergeProperties.dataMergePreferences.recordRange.split('-')[1];//Number of records in the CSV  
    //Loop through the records  
    for(var  i = 0; i < maxRange; i++)  
       {  
       with(myDoc.dataMergeProperties.dataMergePreferences)  
          {  
          recordSelection = RecordSelection.ONE_RECORD;  
          recordNumber = i+1;
          }  
       myDoc.dataMergeProperties.exportFile((destFolderPath + fileNames [i+1] + '.pdf'), "[High Quality Print]", );
       } 
    

    The best thing - IT WORKS! Well, it does, but something very strange happens. If the database is 99 records or less, the script will be run end until it finishes processing the last record and then this dialog appears:

    Screen Shot 2015-07-10 at 11.38.29 pm.png

    If the database is 100 records or more, then the script works very well and no warning appears. Despite the files PDF export properly, present a defect is the only thing that keeps me from being happy with the script. It's like having a sports car which turns around when he touches out of ignition, unless its duct more than 100 km and then it not to do so.

    For once, I am convinced that the script is written correctly, but I can't work on why this error occurs. Is this a bug in the template script ID, or I missed something? Or is this a bug on my computer only? Is anyone able to attempt to reproduce the fault on their own machine?

    Thank you very much

    Colin

    Never mind colleagues posters, I solved my problem.

    From what I can tell, the InDesign is keep in memory the table from the script the first time, it has been run. Not even

    fileNames.length = 0;

    at the end of the script's force at first.

    Way the easiest way is to set a backup statement just before the beginning of the script.

    myDoc.save (myFile);

    and then, at the end of the script, force the script to close the merge file without saving the changes, but open it back to the top

    myDoc.close (SaveOptions.no);

    myDoc = app.open (myFile);

    I tried

    myDoc.revert

    but he keeps setting up a dialog box asking "Are you" sure and I don't see anything in

    Adobe InDesign CS6 (8,0) object model JS: Table of contents

    or

    http://www.indesignjs.de/extendscriptAPI/indesign10/

    that a property to force a return to actually return without the dialog box.

    Regardless, the result is the same – the document close, open and returned to its original state. So far, it seems to work... yay!

  • Extract XML data online on a regular basis.

    Hi guys, I am new to the PL/SQL and im kind of stuck here, what I'm trying to Edifier is:

    There is this file online: [indicadores.xml | http://www.dof.gob.mx/indicadores.xml], which contains data from Exchange rate I need to use.

    I just need to get the < item > elements.

    This feed is updated every day, so what I intend to do is to recover this data each day at midnight and store the data in a single table with the following structure:

    CREATE TABLE RATES
    (
    title VARCHAR2 (CHAR) NOT NULL,
    Description NUMBER NOT NULL,
    pubDate DATE NOT NULL,

    );

    I don't know if it is possible, nor how, I was checking some of the messages on this forum, but most of them parse a local XML file and not a online, also I do not know how can I do on a daily basis.

    Any help will be greatly appreciated!

    Thank you!

    José Manuel Hurtado Portugal

    In this case, you can also do

    SQL> select extractvalue(t.x,'//dc:date', 'xmlns:dc="http://purl.org/dc/elements/1.1/"') datepub,
           extractvalue(t.x,'//cb:value', 'xmlns:cb="http://staging.bis.org/rss-cb/1.0/') valuepub,
           extractvalue(t.x,'//cb:rateName', 'xmlns:cb="http://staging.bis.org/rss-cb/1.0/') ratename
      from (select httpuritype ('http://www.banxico.org.mx/rsscb/rss?BMXC_canal=cetes').getxml () x from dual) t
    /
    DATEPUB                        VALUEPUB                       RATENAME
    ------------------------------ ------------------------------ ------------------------------
    2010-11-30T11:37:29-06:00      4.35                           CETES28
    1 row selected.
    
  • Distribute the data in a column and update new column with data of split

    Hi all

    I'm working on Oracle 10 g. One of my table of the column stores the data, sampled below.

    1722999340KK000200000
    1444210829AB1001EX003
    1444300000CD0148EX003
    1722999340KL 000200000

    I want to split the data in the report between the numbers (4; 6; 6; 5), as shown below and store it in different columns (A1 |) A2 | A3 | A4).
    1444 | 210829 | AB1001 | EX003

    Grateful if someone can give me some advice on how to achieve the same in the SQL database.

    See you soon,.

    novice
    insert into split_tab  (A1,A2,A3,A4)
    select substr(mycolumn,1,4), substr(mycolumn,5,6), substr(mycolumn,11,6), substr(mycolumn,17)
    from myoriginaltab;
    

    Max

  • How to save data from the RT at base of remote Citadel using Citadel api writing

    I try to get a target RT to launch a VI when it is started, which acquires the data and sends them to a database of Citadel on a networked computer.

    I'm doing it with the Citadel write API, more precisely the functions in the DSC module; Open the trace and write trace close path.

    I have a project with the added goal of RT. I have a simple VI under job-generating data and sending it to the local database of the Citadel. This VI works very well and the data is written to the database. However, I have a similar VI under the RT target but open VI track is broken and the VI will not run. It seems that one of the subVIs in Open Trace VI is broken and will not run.

    I'm missing something here. Can someone help me understand this?

    The VI is probably not compatible with real-time, perhaps she calls a DLL or something. What you need to transfer data from RT on a Windows host computer and let that host the insertion in the Citadel.

    Mike...

  • Data type can be same base on the table source for blank column

    We have an employee as mentioned structure table.

    EMPNO NUMBER 4,
    ENAME VARCHAR2 (10),
    USE VARCHAR2 (9).
    MGR NUMBER 4,
    HIREDATE DATE,
    SAL NUMBER (7.2).
    NUMBER (7.2), COMM.
    DEPTNO NUMBER (2)

    I want to create a basic view on the length of data type of same/exact structure. So is it possible that when the view was created, we can define a data type.

    In fact, I need to create a view based on above structure but want get deptno and sum of the salary of emp table column, and the rest of the column will be blank.

    Thank you

    You can use CAST

    create or replace view vu1 as
    select cast(null as  VARCHAR2(10) ) as ENAME,
     ....
    
  • Oracle 10g FRM-41051 on a piece of text data with a LOV non-base

    Hi all

    I am struggling with a problem, I am convinced that must have a really simple solution, but for the life of me I can't understand it!

    I have a block of data called query. It is a block not DB with a certain number of elements, with LOVs or drop-down lists. It is used to choose the values, which are "translated" in the values programmatically in the other two blocks of data of database (which will be populated in the trigger WHEN-BUTTON-PRESSED a button in the block no DB).

    This is necessary because I have a somewhat complex query that can take the values of many different tables and displays items of information of all the different tables.

    My problem is that on my text element (which has a LOV attached to it with the automatic display of the Yes value); When I click it, I expect the LOV to show and I am able to choose a value. Instead I get the error "FRM-41051-you can't create folders here" and does not display the LOV.

    I don't understand this. Everything on the block is an element not DB, including the block itself and I don't want to 'create' all the records, all I want to do is choose values in my text that I can then use in a DB query (written in my trigger).

    What I am doing wrong?

    Abigail

    Make sure that the property 'Insert enabled' is 'YES' for your control block.

  • 2 blocks from the database data insert into the same base table?

    Hello
    I have the C_NEW canvas. On this canvas, elements of 3 blocks are usable by the user.

    1 block NEW_HEAD: 3 Articles say X 1, X 2, X 3
    2 block NEW: record multi say Y1 thru Y10 text fields. Also a scroll bar.
    3 block NEW_ACTION: 6 buttons say B1 to B6 (one of them is N_OK which matches the element in question)

    two NEW, NEW_HEAD blocks are blocks of db and have the same basic so-called BT table when users click on the N_OK (after filling the data in the NEW_HEAD and then NEW block in that order), I need the data between the two the NEW, NEW_HEAD to enter the BT. currently only the NEW data goes to BT. in the BT table fields that correspond to the fields X 1, X 2, X 3 in the NEW_HEAD remains null after clicking on the N_OK button. I put commit_form in the N_OK code, since the blocks are blocks of db (as suggested by the people, it is easier to issue a commit_form that a lot more work in writing my own SQL).

    How can I achieve this?

    Thank you
    Chiru

    There is therefore no N_LC_DMG_ALLOW column in the table, that the block is the result. You must set the property "Section of the database" not for all the elements that are not of the columns in your database table.

    And when an error occurs, then the full treatment stops, so its clear that there is no inserted record.

  • DATA IS MISSING, PLEASE RESTORE base SN master.idx

    How to restore the file?

    Hi Shirley BB,

    1. when exactly do you get this error message?

    2. you remember to make changes to the computer before this problem?

    This seems to be a problem with the AOL software.

    You can see the following link for AOL to fix the error:

    http://help.AOL.com/help/microsites/search.do?cmd=displayKC&docType=kc&externalId=223420&sliceId=1&docTypeID=DT_AOLTROUBLESHOOTING_1_1&dialogID=28324484&StateID=1%200%2028328749

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Speakers do not work error: device not installed Base and the data Interface system / no driver found

    I have a Dell Inspiron 1420 and recently upgraded to Windows 7. It had Windows Vista before. Now my speakers do not play, and they did it when I am running Vista. I did some troubleshooting and got messages from Interface to data and not installed for Base system device, but when I click on apply this patch, I get the message no driver found.

    Most often when a device does not work, it is because the driver is damaged. Re-install a new copy should help

    Remove the driver current completely and install the latest driver available.  For instructions on how to do read everything to update the drivers of my partner JMH3143 http://answers.microsoft.com/en-us/windows/wiki/windows_other-hardware/updating-a-driver/a5e6345e-af9b-4099-bef0-8d22254aa1c1?tm=1436753520149 here

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly? SignedIn = 1

  • export data to excel (data split in leaves n)

    Hello

    Its possible to export data from forms (10g) and thus to divide all data in leaves of n. name of the leaves is from 1 to n. How to do this.
    TNX for all the good people who will try to solve this problem (and also read this post :))

    Sparkling Hi,

    You will find many solutions for export forms to Excel sheet data but splitting that data in leaves n be difficult, I think.

    Carole

  • Fill 4 quarters per year

    Hello

    I would like to help to display the text for each quarter along a value of the current year.  Below, I have the select statement, the data in the table and the expected results.  Everything I am locate online has date ranges or enter an actual date.  I would like that all of the four quarters for each year in the table. Can someone help me with this if possible? Thank you!

    CREATE TABLE QUARTER_YEAR

    (

    PK_QTR_YEAR_ID INTEGER NOT NULL,

    QTR_YEAR INTEGER

    )

    INSERT INTO QUARTER_YEAR (PK_QTR_YEAR_ID, QTR_YEAR)

    VALUES (1,2014);

    INSERT INTO QUARTER_YEAR (PK_QTR_YEAR_ID, QTR_YEAR)

    VALUES (2,2015);

    INSERT INTO QUARTER_YEAR (PK_QTR_YEAR_ID, QTR_YEAR)

    VALUES (3,2016);

    SELECT QTR_YEAR IN THE QUARTER_YEAR;

    -List of the years, dynamically static.

    DATA IN THE TABLE

    QTR_YEAR

    2014

    2015

    2016

    -Hold data to be displayed as below, the

    -four quarters of display for each year.

    QTR_YEAR

    1ST QUARTER 2014

    2ND QUARTER 2014

    3Q 2014

    4TH QUARTER 2014

    QUARTER 1, 2015

    2ND QUARTER 2015

    3Q 2015

    4TH QUARTER 2015

    1 Q 2016

    2ND QUARTERLY

    3Q 2016

    4TH QUARTER OF 2016

    Hello

    So you want all the years that actually exist in the table combined with on a quarterly basis, if they exist or not.

    This sounds like a job for a Cross Join.  Here's one way:

    WITH all_quarters AS

    (

    SELECT TO_CHAR (LEVEL). 'Q' AS qtr

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT DISTINCT

    QA. QTR

    qy.qtr_year

    OF quarter_year qy

    CROSS JOIN all_quarters aq

    ORDER BY qy.qtr_year

    aq.qtr

    ;

    Output:

    QTR QTR_YEAR

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

    1ST QUARTER 2014

    2ND QUARTER 2014

    3Q 2014

    4TH QUARTER 2014

    QUARTER 1, 2015

    2ND QUARTER 2015

    3Q 2015

    4TH QUARTER 2015

    1 Q 2016

    2ND QUARTERLY

    3Q 2016

    4TH QUARTER OF 2016

    Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

  • Incompatible control file and the data after the backup files

    The company that I work has servers where some components are new more, so have a backup in the event of hardware failure. If we intend to do some clones of 1:1 of the current servers to change them in case of emergency. As most of the necessary data is not volatile and we reset stuff in any case, there is no need of replicaton, replace an old version of the database works very well. Now we could not easily get substitutes for our old material, so we had to set up new machines. And that's where my trouble starts, because now I had to actually set up the system and the database rather than do a simple copy of byte to byte. I'm mainly a programmer, using Oracle of 'other' side, but as our DBA is yet to come and the work must be done now...

    So I did some reasearch and decided to do a normal backup of the cold. I have dumped the controlfile, copied data and configuration files to the new server and read the prompt SQL (no mistake there) control file. After some initial hiccups with the system (memory, etc.), I was finally about to start the database, only to get an error ORA-01190 ("1 database or control file is from before the last RESETLOGS").

    I guess I did is a bad thing when you restart the database (used the wrong part of the control file) or when the copy of the data. The original data have split two readers for simplicity and logical, I copied their entire contents. So maybe I don't not copied to little but too?

    As I said in the introductory paragraph, I'm not a DBA, but I'm willing to learn and listen. I don't expect a complete solution, but some guidelines when to look and what to avoid. Any help on this would be appreciated.

    Currently, there are some points need clarification,

    1. you don't need to re-create the control file, if you have a clean shutdown database and copied all the files at the same time (data files, control files etc.)

    2. If you stop DB, copied files of data but do not copy the control at shutdown file, you must re-create the control file.

    3. the error ORA-19909 suggested you resetlog prior to recovery.

    ORA-19909: string data file belongs to an orphan incarnation
    Cause: The data file specified has been restored from a backup that was taken during a period of time that has already been abandoned by a resetlogs operation or Oracle cannot identify what incarnation of database file belongs. The alert log contains more information.
    Action: Restore a backup of this file that belongs to the current or a previous incarnation of the database. If you use RMAN to restore, RMAN automatically selects a good backup.

    4. it would be better that again follow you from scratch the article.

    for example,.

    Copy the files you did copy over the data base to the bottom of the old server,
    modify the control file creation script

    RECOVER DATABASE USING BACKUP CONTROLFILE;
    ALTER DATABASE OPEN RESETLOGS;

  • An effective way to select dynamic data signals

    Is there a better way to select certain combinations of dynamic data from splitting signals the signals and checking them with a case statement and then merge the signals back up?

    The express vi "Select signals" of the range of manipulation of signals seem to works, but it is only good for a predefined set of signals. I want the user to be able to show easily, which indicates that they want.

    Thank you for your comments and suggestions.

    The Express VI select signals has a "Input Selector" where you can plug you want to select by program. Take a look at the example of 'Select signals' which comes with LabVIEW.

  • Modify the Exif data

    Hello world!
    I'm having some trouble surrounding the metadata on some images in my library of images.

    I just started working at a new company and their library of images is a mess. I worked on the automation of a project I've worked on, but so that it works properly, I need to access the metadata for the images that I work with.


    Here's the problem; Many of their images have the date stored in the tab 'base' in 'File Info', but they don't have anything in the exif data. Is their no way to automate Photoshop or bridge (or possibly Automator or Applescript) to fill in the exif data based on the "Date of creation" of in the Basic tab?

    I am at a loss here, there are more than 30,000 images to treat so typing manually for each image is not really an option (I really hope that I am not obliged)

    I really appreciate any help and suggestions.

    Thank you all!

    -Jeremy

    I downloaded the script you need to be connected and put it here for you...

    Wikisend: free file-sharing service

Maybe you are looking for