Ask retreival of data monthly

Hai all

10.2.0.5 on solaris 10

I use the query to retrieve the data files created with tablespace name below

select a.creation_time,b.tablespace_name  from v$datafile a,dba_data_files b where b.file_id=a.file# order by a.creation_time desc;
output is
4/7/2013 10:13:42 AM     TS_IMSI_IMEI_COUNTER03
4/7/2013 10:11:56 AM     TS_IMSI_IMEI_COUNTER03
4/7/2013 10:10:14 AM     TS_RATED_GPRS_CDR14
Now, I need an application to retrieve the number of data files created on tablespaces
for the past 6 months, in such a way that the output is as below:
Month           No of datafiles          tablespacename

Mar2013      4                system
Can someone guide me

Hello

Here's one way:

SELECT    TO_CHAR ( TRUNC (v.creation_time, 'MONTH')
              , 'Mon YYYY'
            )          AS month
,       COUNT (*)          AS no_of_datafiles
,       d.tablespace_name
FROM        v$datafile           v
,       dba_data_files     d
WHERE        d.file_id     = v.file#
GROUP BY  TRUNC (v.creation_time, 'MONTH')
,            d.tablespace_name
ORDER BY  TRUNC (v.creation_time, 'MONTH')        DESC
,            d.tablespace_name
;

TRUNC allows to map all creation_times to once a month.
Use the COUNT aggregation function to get the number of files.
Using an aggregate function means that you will have to GROUP BY, the month and the tablespace.

Tags: Database

Similar Questions

  • the sidebar calendar shows like orange, no date, month

    the sidebar calendar shows like orange, no date, month

    the sidebar calendar shows like orange, no date, month

    Double-click on an empty place.

  • How to get the Date, month, year of the DateTimePicker

    Hi, I am using the DateTimePicker.

    There are several question about this command:

    1. how to get the Date, month and year?

    -With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?

    2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?

    Thank you

    dateTimePicker.value return a QDateTime not a string.

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value

    See more:

    https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date

    https://developer.BlackBerry.com/Cascades/reference/QDate.html

    You can get

    day = dateTimePicker.value.date().day()
    month = dateTimePicker.value.date().month()
    year= dateTimePicker.value.date().year()
    dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate)
    dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD")
    dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
    
  • just to ask the expiry date of my subscription?

    just to ask the expiry date of my subscription to Photoshop?

    Journal ate Adobe.com go to manage your account and to manage your plans

  • How to convert Date months in the database that points to the EBS, DWH not.

    Hi friends,

    We intend to create reports in OBIEE and the Source is EBS. This means that we do not want depends on Datawarehouse and Informatica and OBIApps. Simply create us some reports and that they refer to the EBS database.

    End of test, we took an HR report and it contains under columns:

    Months (Sun)
    Revenue by Division (Fact)
    Average cost per numbers of workforce (Fact)

    In my little survey, we found that the income column is of EBS: GL_BALANCES. And we have configured the base of W_Day_D table in DAC has no column months in EBS (not sure).

    Come to my problem, how can I call the month column in my data base stressed EBS. How to convert the Date months in my database.

    I can deceive me, but someone please look into this... How can I create columns for this exact report of OBI in EBS database instead of DwH.

    Thanks in advance...

    Raghu Jen7782

    Just confused here.

    Hang on, if I get it, you want to create report based on columns of EBS directly then using rt BI applications?

    There is then no question of using the W_DAY_D table then.

    Follow

    As long as you have Date column, you can use DB functions to convert them into months (just use the string SUBSTR to extract the month and the year).
    Create your own query instead of using the tables of BI APPS and try to bring a hybrid product.

    Sorry I'm wrong in the understanding of your needs, if I had properly then do the steps above.

    Mark correct or useful if this can help,

    Kind regards
    Rayan Vieira

  • Can I change the date format day/United States (month day year) in the United Kingdom (date month year)?

    When I consult databases via Firefox, the format of date/day is set at: day, month, year (AMERICAN style), while I need, day, month, year, I work in the United Kingdom and the 'bad' format is VERY confusing and could lead to errors and mistakes. IE has that format, but I don't want to return to using that.

    You use the English (United States) version of Firefox ESR 24.3.0. You can download the English version of (British) below:

    1. under Options - content - language, make sure that English/United Kingdom [en-us] is located at the top of the list.

    2. in the Windows Control Panel category, region and language, make sure that the short Date is set at your convenience.

    You can check the date and time at the library of Firefox, bookmarks category format. Press Ctrl + Shift + B to open it, and then note the dates in the added to the right column.

  • Transposition of data monthly columnar to lines

    Hello
    I need to transpose data in the query being this:
    (Projects with a monthly allowance of resources in hours).

    Proj Resrc jan Feb mar Apr
    ABC Proj1 5 9 6 9
    Proj1 def 4 7 8 0
    hij Proj1 30 0 0 0
    Proj1 0 40 30 20 klm
    Proj2 nop 20 30 10 20
    QRS Proj2 5 9 6 9
    Proj2 abc 30 0 0 0
    proj3 0 40 30 20 klm
    proj3 26 34 40 20 nop
    proj3 20 23 50 20 TÜV
    proj3 xyz 4 7 8 0
    PROJ4 abc 30 0 0 0


    To do this:

    Proj Resrc month hours
    ABC Proj1 January 5
    ABC Proj1 February 9
    abc Proj1 6 Mar
    Proj1 abc Apr 9
    Proj1 def jan 4
    Proj1 def 7 Feb
    Proj1 def mar 8
    Proj1 def Apr 0
    hij Proj1 30 jan
    hij Proj1 Feb 0
    Mar hij Proj1 0
    Proj1 hij Apr 0
    ....
    .....
    NOP Proj2 jan 20
    NOP Proj2 30 Feb
    Proj2 nop mar 10
    Proj2 nop apr 20
    Proj2 grs 5 jan
    Proj2 9 Feb grs
    Proj2 grs 6 mar
    Proj2 grs apr 9
    Proj2 abc 30 jan
    Abc Feb Proj2 0
    abc Proj2 Mar 0
    Proj2 abc Apr 0
    .....
    .....

    My data is 11g. Wonder what would be the best way to do this in SQL or Pl/SQL? Would be unpivot get me? I don't do any data set, simply transpose monthly columns in the lines as shown above.

    Thanks for any help.

    Pat

    Hi, Pat.

    patfmnd wrote:
    ... My data is 11g. Wonder what would be the best way to do this in SQL or Pl/SQL? Would be unpivot get me?

    Yes, SELECT it. UNPIVOT Oracle 11 feature is all you need. There are examples in the manual of the SQL language:
    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/statements_10002.htm#sthref6829

    You post CREATE TABLE and INSERT statements for your table, so I'll use scott.emp for example.
    A simple query, no dynamic crossroads, showing the 3 numeric columns (empno, sal and comm) can be:

    SELECT       ename, job, empno, sal, comm
    FROM       scott.emp
    WHERE       deptno     = 30
    ORDER BY  ename
    ;
    

    Output:

    ENAME      JOB            EMPNO        SAL       COMM
    ---------- --------- ---------- ---------- ----------
    ALLEN      SALESMAN        7499       1600        300
    BLAKE      MANAGER         7698       2850
    JAMES      CLERK           7900        950
    MARTIN     SALESMAN        7654       1250       1400
    TURNER     SALESMAN        7844       1500          0
    WARD       SALESMAN        7521       1250        500
    

    Now that you want to unpivot these results. Instead of having 6 lines, each with 3 number of columns, 18 lines, each with only 1 of these kinds, like this:

    ENAME      JOB       LABEL         NUM
    ---------- --------- ------ ----------
    ALLEN      SALESMAN  COMM          300
    ALLEN      SALESMAN  EMPNO        7499
    ALLEN      SALESMAN  SALARY       1600
    BLAKE      MANAGER   COMM
    BLAKE      MANAGER   EMPNO        7698
    BLAKE      MANAGER   SALARY       2850
    JAMES      CLERK     COMM
    JAMES      CLERK     EMPNO        7900
    JAMES      CLERK     SALARY        950
    MARTIN     SALESMAN  COMM         1400
    MARTIN     SALESMAN  EMPNO        7654
    MARTIN     SALESMAN  SALARY       1250
    TURNER     SALESMAN  COMM            0
    TURNER     SALESMAN  EMPNO        7844
    TURNER     SALESMAN  SALARY       1500
    WARD       SALESMAN  COMM          500
    WARD       SALESMAN  EMPNO        7521
    WARD       SALESMAN  SALARY       1250
    

    Here's a way to get these results:

    SELECT       ename, job, label, num
    FROM       scott.emp
    UNPIVOT       INCLUDE NULLS
           (     num
           FOR     label     IN ( empno
                        , sal     AS 'SALARY'     -- rename if you want to
                      , comm     AS 'COMM'
                      )
           )
    WHERE       deptno     = 30
    ORDER BY  ename
    ,            label
    ;
    

    Published by: Frank Kulash, may 2, 2012 17:43
    Example added scott.emp

  • Problem connecting creative cloud - has repeatedly asked for the date of birth

    After purchasing the CC and trying to login I continually ask myself for my brithdate. After the seizure of the date of birth, the screen comes back again to ask my date of birth. Can't get through this screen so that I can download the CC apps. Any suggestions?

    Hi Donatello3,

    Welcome to the community!

    I checked your account and found that there is a problem with your Adobe ID, i.e. the email address. Please check this link http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html and if this does not help, then click on Chat contact button our Adobe now support team and they will solve the problem.

    Thank you!

    Ankit

  • CS6 Master Collection ask for password after months of use

    Why CS6 is now asking a password again after months of use?  I already entered a valid passwork during installation.  I am running on a 15 "Macbook Pro Mountain Lion.  I run Photoshop, and then I get this screenScreen Shot 2013-04-27 at 2.25.42 PM.png

    But I already have a password and have installed CS6 six months ago.  Even when I enter the password, it sticks and me and this dialog at every launch.

    Tom,

    Can you provide the AMT3.log for a look, he can help us to know the problem.

    You can find the file the slot location: -.

    \Users\[username]\AppData\Local\Temp

    Also please move the cache.db desktop file and then launch the software, serialize with the serial number and then close and reopen it.

    The cache.db file location is: / Library/Application Support/Adobe/Adobe PCD/cache

  • year of data month interval tape question

    Mr President

    I'm new to all aspects of Database.I getting ready for 051. but I need assistance helps dispel a doubt on year interval to the months of doubt data types.
    create table time_example2
    ( loan_duration INTERVAL YEAR (3) TO MONTH
    
    );
    next insert statement:
    INSERT INTO time_example2
    (loan_duration)
    VALUES
    (INTERVAL '120' MONTH(3)
    );
    AS I am specifying the size create statement why I need to specify the size of the MONTH in the insert statement.

    Interesting, I didn't realize, you can specify the precision for YTM interval literals but it seems [you can | http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements003.htm#sthref362], and

    INTERVAL '3' MONTH(3)
    

    is equivalent to

    INTERVAL '0-3' YEAR(3) TO MONTH
    

    Why anyone would use every month, I don't know, but it's there.

  • Retreival of data from the old hard drive - it freezes the computer when it is connected to the outside

    I have a dell laptop and last week he showed the blue screen and does not start. I got improtant data on starting I have is not a format and replaced with a new hard drive. Now I'm trying to connect to the old hard drive externally detected only D & does not detect drive C on what it blocks my laptop. I tried with other laptops & systems also, but it's the same thing. I have important data in two players. Please suggest a possible solution to recover data.

    Hello

    • What is the blue screen error message that you receive?
    • Have you tried plugging the drive with another computer?
     
    You can check this link:
     
    You can also try updating the chipset drivers on the manufacturer's Web site.
     
  • Date field format like: name/Date/month day

    Is there a way to validate a field 'date' to display a date in the form: Tuesday, July 5, 2016 instead of 05/07/2016? Even if abbreviated day (kills instead of Tuesday) name is "very well. I can't find out how to get in shape in this way. In addition, most date formats also have a value of time associated with them. I don't want / need time in this area.

    Just to try to make it clear!

    1. Add a Date/time field

    2. click on "templates...". '--> 'View' (in the 'Field' tab in the 'object palette")

    3. Enter the date {EEEE, MMMM D, YYYY} in the entrance area of 'model '.

    In my view, there is a preset that is almost identical to that of the predefined display templates aswell.

  • Doubt function to_char (date, 'month')

    Hello

    Hope you have a great day.

    I have an installation of forms (Forms11gr2 11.1.2.2 64 bit on Red Hat EL 6 64 bit) where I have a forms module, where I am using the following code, which should return the name of the month in Spanish but he returns in English:

     RESULTADO := TO_CHAR(TO_DATE('10/10/2014','DD/MM/YYYY'),'MONTH');
    

    If I run the previous code on SqlDeveloper, it returns the month in Spanish without problem, but it seems that I should do something else either on the side of Weblogic.

    The database version is 11.2.0.3 64 bit.

    What should I do?

    Concerning

    Carlos

    You must set the NLS_LANG variable in your EPS file ("default.env" If you don't change it) on the appropiately weblogic server.

  • Ask help pls dates and logical.

    Hi all the gurus

    I need where I need to put togahter of series of the chronology of events in the past as a line on the dates.

    It comes to my table.

    CREATE TABLE 'GET OUT '. "" SOR_TRACKING ".

    (ACTIVATE THE "TRACKING_ID" NUMBER NOT NULL,)

    ACTIVATE THE "LETTER_ID" NUMBER NOT NULL,

    ACTIVATE THE "OFFENDER_ID" NUMBER NOT NULL,

    ACTIVATE THE 'LOCATION_ID' NUMBER NOT NULL,

    NUMBER OF "OFFICE_ID."

    ACTIVATE THE "MAIL_DATE" DATE DEFAULT SYSDATE NOT NULL,.

    DATE OF THE "RESPONSE_DATE."

    "STATUS' VARCHAR2() 30 BYTES) by DEFAULT"sent. "

    ACTIVATE THE "ENTRY_DATE" DATE DEFAULT SYSDATE NOT NULL,.

    'ENTRY_USER'(VARCHAR2) 30 BYTES) ENABLE NOT NULL,.

    'COMMENTS' VARCHAR2() 2000 BYTES).

    "First name"(VARCHAR2) 80 BYTES) ENABLE NOT NULL,.

    "MIDDLE_NAME"(VARCHAR2) 80 BYTES).

    'Name'(VARCHAR2) 80 BYTES) ENABLE NOT NULL,.

    'SIR_NAME'(VARCHAR2) 30 BYTES).

    "Address1"(VARCHAR2) 80 BYTES).

    "Address2"(VARCHAR2) 80 BYTES).

    'CITY' VARCHAR2() 50 BYTES).

    ('STATE' VARCHAR2() 30 BYTES).

    "ZIP"(VARCHAR2) 20 BYTES).

    'COUNTY'(VARCHAR2) 80 BYTES).

    'OFFENDER_TYPE'(VARCHAR2) 30 BYTES).

    DATE OF THE "LAST_MAIL_DATE."

    ACTIVATE THE "BATCH_ID" NUMBER NOT NULL,

    NUMBER OF "COMPETENCE."

    'DL_NAME'(VARCHAR2) 60 BYTES).

    'DL_OFFICE'(VARCHAR2) 60 BYTES).

    'DL_ADDRESS'(VARCHAR2) 60 BYTES).

    'DL_MAILING_ADDRESS'(VARCHAR2) 60 BYTES).

    'DL_CITY'(VARCHAR2) 60 BYTES).

    'DL_STATE'(VARCHAR2) 30 BYTES).

    'DL_ZIP'(VARCHAR2) 20 BYTES).

    "TITLE"(VARCHAR2) 10 BYTES).

    'MODIFIED_USER'(VARCHAR2) 30 BYTES).

    DATE OF THE "MODIFIED_DATE."

    KEY CONSTRAINT PRIMARY 'PK_SOR_TRACKING' ('TRACKING_ID'))

    Date of the sample

    INSERTION of REM in SOR_TRACKING

    TOGETHER TO DEFINE

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE ((, MODIFIED_USER, MODIFIED_DATE) values (781410,1,4557,110207,2809, to_date (November 5, 13 ',' DD-MON-RR'), null, 'Sent mail', to_date (November 5, 13 ',' DD-MON-RR'), "NOMA", null, 'BOB","Jolene","Luna", null, ' 20535 Valleyview Rd', null,'Boo','OK','74840','potter','STANDARD',to_date('15-FEB-12','DD-MON-RR'),30211,2809,null,null,null,null,null,null,null,'Ms.','NEEL',to_date('05-NOV-13','DD-MON-RR '));

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (190294,1,4557,110207,2809, to_date (February 8, 12 ',' DD-MON-RR'), to_date (February 15, 12 ',' DD-MON-RR'), 'Checked', to_date (February 17, 12 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, ' 20535 Valleyview Rd', null, 'Boo', 'OK', '74840', 'potter', 'STANDARD', to_date('13-DEC-11','DD-MON-RR'), 28442,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (184647,1,4557,110207,2809, to_date (December 5, 11 ',' DD-MON-RR'), to_date (December 13, 11 ',' DD-MON-RR'), 'Checked', to_date (December 15, 11 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, ' 20535 Valleyview Rd', null, 'Boo', 'OK', '74840', 'potter', 'STANDARD', to_date('09-NOV-11','DD-MON-RR'), 27985,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (157253,1,4557,102288,2809, to_date (February 3, 11 ',' DD-MON-RR'), null, 'Sent mail', to_date (February 3, 11 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('08-NOV-10','DD-MON-RR'), 25613,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (149710,1,4557,102288,2809, to_date (November 1, 10 ',' DD-MON-RR'), to_date (November 8, 10 ',' DD-MON-RR'), 'Checked', to_date (November 16, 10 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('18-OCT-10','DD-MON-RR'), 24939,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (138268,1,4557,99564,2809, to_date (June 3, 10 ',' DD-MON-RR'), to_date (June 17, 10 ',' DD-MON-RR'), 'Letter returned', to_date (June 17, 10 ',' DD-MON-RR'),'Boo ',' post office: no taking mail ', "BOB", "Jolene", "Luna", null, 20535 Valley View Rd.', null, 'Boo', 'OK', '74840', 'potter', 'STANDARD', to_date('19-MAY-10','DD-MON-RR'), 24216,2809,null,null,null,null,null,null, null) 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (128798,1,4557,91503,2809, to_date (February 4, 10 ',' DD-MON-RR'), null, 'Sent mail', to_date (February 4, 10 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('10-NOV-09','DD-MON-RR'), 23369,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (115073,1,4557,91503,2809, to_date (7 August 09 ',' DD-MON-RR'), to_date (10 November 09 ',' DD-MON-RR'), 'Checked', to_date (10 November 09 ',' DD-MON-RR'), 'Boo', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('06-MAY-09','DD-MON-RR'), 21926,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (108510,1,4557,91503,2809, to_date (5 May 09 ',' DD-MON-RR'), to_date (6 May 09 ',' DD-MON-RR'), 'Checked', to_date (7 May 09 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('01-MAY-09','DD-MON-RR'), 21316,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (101463,1,4557,88052,2809, to_date (5 February 09 ',' DD-MON-RR'), null, 'Sent mail', to_date (5 February 09 ',' DD-MON-RR'), 'Boo', null, 'BOB', "Jolene", "Luna", null, PO Box 146, null, 'Boo', 'OK', '74840', 'potter', 'STANDARD', to_date('15-DEC-08','DD-MON-RR'), 20525,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (97272,1,4557,88052,2809, to_date (5 December 08 ',' DD-MON-RR'), to_date (15 December 08 ',' DD-MON-RR'), 'Checked', to_date (17 December 08 ',' DD-MON-RR'), 'Casper', null, 'BOB', 'Jolene', 'Luna', null, 'P.c. 146', null, 'Boo', 'OK','74840 ', 'potter', 'STANDARD', to_date('12-NOV-08','DD-MON-RR'), 20018,2809,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (to_date 68398,1,4557,76399,1070, (10 October 07 ',' DD-MON-RR'), to_date (15 November 07 ',' DD-MON-RR'), 'Letter returned', to_date (15 November 07 ',' DD-MON-RR'), 'KERRYMIN',' post office: not delivaerable then addressed ', 'BOB","Jolene","Luna", null, 752 Boo ', null, 'Norman', 'OK','73072 ', 'Cleveland', 'STANDARD', to_date('17-MAY-07','DD-MON-RR'), 16596,1070,null,null,null,null,null,null,null, 'Ms.', null) ", null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (63767,1,4557,76399,1070, to_date (9 August 07 ',' DD-MON-RR'), to_date (20 August 07 ',' DD-MON-RR'), 'Letter returned', to_date (20 August 07 ',' DD-MON-RR'), 'KERRYMIN',' post office: not deliverable as addressed ', "BOB", "Jolene", "Luna", null, 752 Boo', null, 'Norman', 'OK', '73072', 'Cleveland', 'STANDARD', to_date('17-MAY-07','DD-MON-RR'), 16077,1070,null,null,null,null,null,null,null, 'Ms.', null) ", null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (59499,1,4557,76399,1070, to_date (14 May 07 ',' DD-MON-RR'), to_date (17 May 07 ',' DD-MON-RR'), 'Checked', to_date (17 May 07 ',' DD-MON-RR'), 'LAWANHAM', null, 'BOB', "Jolene", "Luna", null, 752 Boo ', null, 'Norman', 'OK','73072 ', 'Cleveland', 'STANDARD', to_date('14-MAY-07','DD-MON-RR'), 15569,1070,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (54783,1,4557,74693,1070, to_date (1 March 07 ',' DD-MON-RR'), to_date (6 March 07 ',' DD-MON-RR'), 'Checked', to_date (13 March 07 ',' DD-MON-RR'), 'Boo', null, 'BOB', 'Jolene', 'Luna', null, '1203 Rebecca Lane', null, 'Norman', 'OK', '73072', 'Cleveland', 'STANDARD', to_date('01-MAR-07','DD-MON-RR'), 14994,1070,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP ((, TITLE, MODIFIED_USER, MODIFIED_DATE) values (34100,1,4557,58761,1094,to_date('08-FEB-06','DD-MON-RR'),null,'Mailed',to_date('31-MAR-06','DD-MON-RR'),'LAWANHAM','per M. Splawn', 'BOB', 'Jolene', 'Luna' null, 'RT. 1 Box 42' null, 'Wewoka', 'OK', '74884', 'Seminole', 'STANDARD' (to_date '03-FEB-06', ' DD-MON-RR'),9560,1094,null null null null null null, null, 'Ms.' null, null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (27562,1,4557,52781,1115, to_date (8 November 05 ',' DD-MON-RR'), null, 'Sent mail', to_date (8 November 05 ',' DD-MON-RR'), 'Boo', null, "BOB',"Jolene","Luna", null, 5590 Rebel Ridge Rd ', null", El Reno, OK ', ' 73036', 'Canadian', 'STANDARD', to_date('16-OCT-05','DD-MON-RR'), 8034,1115,null,null,null,null,null,null,null, 'Ms.', null, null);

    Insert into SOR_TRACKING (TRACKING_ID LETTER_ID OFFENDER_ID, location_id OFFICE_ID MAIL_DATE RESPONSE_DATE STATE, ENTRY_DATE ENTRY_USER COMMENTS, FIRST_NAME, MIDDLE_NAME LAST_NAME, SIR_NAME Address1 address2 CITY ,,ZIP COUNTY OFFENDER_TYPE LAST_MAIL_DATE BATCH_ID JURISDICTION DL_NAME DL_OFFICE DL_ADDRESS DL_MAILING_ADDRESS DL_CITY DL_STATE DL_ZIP ) ,TITLE,MODIFIED_USER,MODIFIED_DATE) values (11822,1,4557,39238,1094,to_date('03-MAR-05','DD-MON-RR'),null,'Mailed',to_date('03-MAR-05','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'Rt. 1, Box 42',null,'Wewoka','OK','74884','Seminole','STANDARD',to_date('17-FEB-05','DD-MON-RR'),306,null,null,null,null,null,null,null,null,'Ms.',null,null);

    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP TITRE (, MODIFIED_USER, MODIFIED_DATE) values (2257,1,4557,18958,1087, to_date (3 August 04 ',' DD-MON-RR'), null, "Sent mail", to_date (29 January 05 ',' DD-MON-RR'), 'SYSTEM', null, 'BOB', "Jolene", "Luna" ', null, ' ' training of 1037 Tabor, null, 'Oklahoma City', 'OK', '73107', null, null, "Oklahoma", 178, null, null, null, null, null, null, null, null, null, null, null);

    I want to find all the records where the mail date() oldest of all without the answer) and no response date and find the one earlier including the response date and display it as a line.

    For example

    mail_Date + 45 table mail_Date earlier response

    DEL_DATES END_DATE TRACKING_ID BEGIN_DATE

    17 SEP-04 3 AUGUST 04 2257 6 MARCH 07

    Other date and their date of response should be the same way

    The problem is that I am not able to retrieve other records in the tables because I use the MIN function.

    here is my request

    SELECT t. MAIL_DATE + begin_Date 45,

    del_date.del_dates,

    (St2 SELECT MIN().) Del_end_date RESPONSE_DATE)

    Sor_tracking ST2

    WHERE t. OFFENDER_ID = st2. OFFENDER_ID

    AND st2. RESPONSE_DATE > del_date.del_dates

    ) End_date.

    t . OFFENDER_ID,

    t . TRACKING_ID

    Of

    (St1 SELECT MIN().) Del_dates MAIL_DATE)

    OF sor_tracking st1

    WHERE the st1. OFFENDER_ID = 4557

    AND st1. RESPONSE_DATE IS NULL

    AND st1. MAIL_DATE < SysDate - 45

    AND st1. STATUS ('letter returned', 'sent')

    AND st1. LETTER_ID IN (1, 4)

    ) del_date,.

    sor_tracking t

    OÙ t. MAIL_DATE < = del_date.del_dates

    ET (t. OFFENDER_ID = 4557

    ET t. RESPONSE_DATE IS NULL)

    ORDER BY 1 desc

    Thank you for your time and help.

    with

    sor_tracking as

    (select 4557 offender_id

    1 letter_id,

    to_date('05-Nov-13','dd-mon-yy') mail_date,

    781410 tracking_id

    110207 location_id,

    response_date null,

    Status "sent mail".

    of the double

    Union of all the

    Select 4557,1, to_date (8 February 12 "," dd-MON-yy'), 190294,110207, to_date (15 February 12 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (5 December 11 "," dd-MON-yy'), 184647,110207, to_date (13 December 11 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (3 February 11 "," dd-MON-yy'), 157253,102288, null, 'By' from dual union all

    Select 4557,1, to_date (1 November 10 "," dd-MON-yy'), 149710,102288, to_date (8 November 10 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (3 June 10 "," dd-MON-yy'), 138268,99564, to_date (17 June 10 "," dd-MON-yy'), 'Returned letter' from dual union all

    Select 4557,1, to_date (4 February 10 "," dd-MON-yy'), 128798,91503, null, 'By' from dual union all

    Select 4557,1, to_date (7 August 09 "," dd-MON-yy'), 115073,91503, to_date (10 November 09 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (5 May 09 "," dd-MON-yy'), 108510,91503, to_date (6 May 09 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (5 February 09 "," dd-MON-yy'), 101463,88052, null, 'By' from dual union all

    Select 4557,1, to_date (5 December 08 ',' dd-MON-yy'), 97272,88052, to_date (15 December 08 ',' dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (10 October 07 ',' dd-MON-yy'), 68398,76399, to_date (15 November 07 ',' dd-MON-yy'), 'Returned letter' from dual union all

    Select 4557,1, to_date (9 August 07 ',' dd-MON-yy'), 63767,76399, to_date (20 August 07 ',' dd-MON-yy'), 'Returned letter' from dual union all

    Select 4557,1, to_date (14 May 07 ',' dd-MON-yy'), 59499,76399, to_date (17 May 07 ',' dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (1 March 07 "," dd-MON-yy'), 54783,74693, to_date (6 March 07 "," dd-MON-yy'), "Verified" of any union double

    Select 4557,1, to_date (8 February 06 "," dd-MON-yy'), 34100,58761, null, 'By' from dual union all

    Select 4557,1, to_date (8 November 05 ',' dd-MON-yy'), 27562,52781, null, 'By' from dual union all

    Select 4557,1, to_date (3 March 05 ',' dd-MON-yy'), 11822,39238, null, 'By' from dual union all

    Select 4557,1, to_date (3 August 04 "," dd-MON-yy'), 2257,18958, null, 'By' from dual

    )

    Select offender_id,

    letter_id,

    to_char(EVENT_DATE,'dd-mon-yy') mail_date,

    tracking_id,

    Location_id,

    cases where last_response_verified is null

    then the status

    status of end,

    to_char(last_response_verified,'dd-mon-yy') response_date,

    cases where last_response_verified is not null

    then 'Verified '.

    end response_status

    from (select offender_id,

    letter_id,

    EVENT_DATE,

    tracking_id,

    Location_id,

    status,

    to_find,

    verified_response,

    LAST_VALUE (verified_response Ignore Nulls) over (partition offender_id, letter_id

    event_date desc order

    ) last_response_verified

    from (select offender_id,

    letter_id,

    EVENT_DATE,

    tracking_id,

    Location_id,

    status,

    -case when event_date< lead(event_date)="" over="" (partition="" by="">

    event_date order

    ) - 45

    then 'THIS '.

    When status = 'by '.

    and lead (tracking_id) (partition offender_id, letter_id, tracking_id

    event_date order

    ) is null

    and direction! = lag(direction,1,'null') on (partition offender_id, letter_id

    event_date order

    )

    then 'this '.

    end to_find

    -case when status = 'Verified '.

    then event_date

    end verified_response

    from (select offender_id,

    letter_id,

    mail_date event_date,

    tracking_id,

    Location_id,

    Status "Sent mail"

    direction 'sent '.

    of sor_tracking

    Union of all the

    Select offender_id,

    letter_id,

    response_date,

    tracking_id,

    Location_id,

    status,

    direction "rcvd.

    of sor_tracking

    where response_date is not null

    )

    )

    )

    where to_find is not null

    event_date desc order

    OFFENDER_ID LETTER_ID MAIL_DATE TRACKING_ID LOCATION_ID STATUS RESPONSE_DATE RESPONSE_STATUS
    4557 1 NOVEMBER 5, 13 781410 110207 Mailed - -
    4557 1 3 FEBRUARY 11 157253 102288 - DECEMBER 13, 11 Checked
    4557 1 FEBRUARY 4, 10 128798 91503 - NOVEMBER 8, 10 Checked
    4557 1 7 AUGUST 09 115073 91503 - 10 NOVEMBER 09 Checked
    4557 1 5 FEBRUARY 09 101463 88052 - 6 MAY 09 Checked
    4557 1 3 AUGUST 04 2257 18958 - 6 MARCH 07 Checked

    Concerning

    Etbin

  • Ask about the dates

    in the table below

    rm_limit

    as_on_dt limit_expiry_date OS ctry_id
    MARCH 13, 2011 5000 1 JUNE 12, 2011
    APRIL 15, 2010 6000 1 DECEMBER 5, 2011
    MAY 1, 2009 3 NOVEMBER 2011-156-2

    How can I write a query for the Sub statement:--

    If in rm_limit difference between the two being on the date and the limit_expiry_date > 180, but less than 365 days then the sum of all o/s (for the ctry_id in column 1)

    Apostrophes would make "180" in a literal string, so the answer is categorically NO!

    180 is a literal number - '180' is a string literal. Since you have a numerical value (the result of the subtraction of a date from a date), then you want to compare with a literal number.

    Do not compare the strings, numbers or vice versa...

Maybe you are looking for