Get registration using min date

Oracle 10g

Hi gurus

I get a few problem of performance and grateful if someone help out me. I have the table sample as below:

Examples of data

WITH AS A REFERENCE

(

SELECT 1000 case_id, 1 c_point, to_date('01-jan-2015') crt_dt, to_date('01-feb-2015') next_crt_dt, 4 next_c_point OF DOUBLE UNION ALL

SELECT 1000 case_id, 1 c_point, to_date('01-jan-2015') crt_dt, to_date('01-mar-2015') next_crt_dt, 5 next_c_point OF DOUBLE UNION ALL

SELECT 1000 case_id, 1 c_point, to_date('01-jan-2015') crt_dt, to_date('01-apr-2015') next_crt_dt, 5 next_c_point OF DOUBLE UNION ALL

SELECT 1000 case_id, 1 c_point, to_date('01-jan-2015') crt_dt, to_date('01-jun-2015') next_crt_dt, 7 next_c_point FROM DUAL

)

Select distinct d.case_id, c_point, crt_dt

,

(

Select min (next_crt_dt)

reference (Datum) dd

where dd.case_id = d.case_id

)

min_dt

,

(by selecting next_c_point in DATUM dd

where dd.case_id = d.case_id

and NEXT_CRT_DT = (select min (next_crt_dt) DATUM dd

where dd.case_id = d.case_id

)

) next_c_point_final

reference d;

The query result

CASE_ID, C_POINT, CRT_DT, MIN_DT, NEXT_C_POINT_FINAL

1000 1 1 JANUARY 15 1ST FEBRUARY 15 4

Query is showing good result but I am wondering it is any other way to do the same thing instead of get requests additional data, see data in red text...

Concerning

MIT

Hi Mitchels,

Here is the implementation of the function table that mask the query and is able to pass to the query parameters.

create or replace
type datum_object force is object (
  case_id number,
  c_point number,
  crt_dt date,
  min_dt date,
  next_c_point_final number
);
/
create or replace
type datum_table is table of datum_object;
/

create or replace
function datum_report(p_hearing_dt date)
return datum_table pipelined
is
begin
  for r in (
    select
      datum_object(
        1000,
        1,
        p_hearing_dt,
        date '2015-02-01',
        4
      ) as datum_object
    from dual
  )
  loop
    pipe row(r.datum_object);
  end loop;
end;
/
-- test
set linesize 130
alter session set nls_language=american nls_territory=america
;
select distinct
  case_id,
  c_point,
  crt_dt,
  min_dt,
  next_c_point_final
from table(datum_report(date '2015-01-01'))
;
drop function datum_report
;

Type DATUM_OBJECT compiled
Type DATUM_TABLE compiled
Function DATUM_REPORT compiled
Session altered.

   CASE_ID    C_POINT CRT_DT    MIN_DT                         NEXT_C_POINT_FINAL
---------- ---------- --------- --------- ---------------------------------------
      1000          1 01-JAN-15 01-FEB-15                                       4

Function DATUM_REPORT dropped.

Tags: Database

Similar Questions

  • Get form using BrowserField2 data

    Hi all

    I try to get the data in the fields of entry in a form HTML rendered in a BrowserField. I want to get the content when the user submits the form to a URL using a custom protocol. I've set up a BrowserFieldNavigationRequestHandler for the Protocol, and it receives applications correctly.

    I have the following HTML FORM:

    Campo text

    My problem is when the user submits the form by tape adhesive press the BrowserFieldNavigationRequestHandler receives the request such as GET and no information field is submitted, not even in query string format.

    Can any ideas on how I get my form data?

    Hi and welcome to the forums!

    You should be able to retrieve the post data by creating your own BrowserFieldNavigationRequestHandler, assigning to the ProtocolController of the BrowserField. This is the handleNavigation (BrowserFieldRequest request) function is called whenever a page is requested and the post data can be retrieved from the subject of the application by using the getPostData() call.

    See you soon,.

  • When I try to use automatic dates, I get code 8007005. I ran the check disk and there is no problem here.

    When I try to use automatic dates, I get code 8007005. I ran the check disk and there is no problem here.

    Hello

    see if that helps to fix:

    How to reset the Windows Update components?

    There is also an automatic 'fix - it' here

    http://support.Microsoft.com/kb/971058

    Also, try to put the KB numbers in the search on the link below and then manually download the

    http://www.Microsoft.com/downloads/en/default.aspx

     

    or please repost your question in the correct windows update forum

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update?page=1&tab=all

  • How to get min date each month for six months?

    Hi, I have data like this.

    Process_date SEQ_No
    ------------- ---------
    16 MARCH 13 733
    9 MARCH 13 732
    MARCH 2, 13 731
    24 FEBRUARY 13 730
    16 FEBRUARY 13 728
    9 FEBRUARY 13 727
    2 FEBRUARY 13 726
    26 JANUARY 13 725
    21 JANUARY 13 724
    JANUARY 12, 13 723
    5 JANUARY 13 722
    29 DECEMBER 12 721
    24 DECEMBER 12 720
    15 DECEMBER 12 719
    DECEMBER 8, 12 718
    3 DECEMBER 12 717
    22 NOVEMBER 12 716
    NOVEMBER 17, 12 715
    10 NOVEMBER 12 714
    NOVEMBER 3, 12 713
    29 OCTOBER 12 712
    23 OCTOBER 12 711
    13 OCTOBER 12 710
    OCTOBER 5, 12 709
    28 SEP-12 708
    22 SEP-12 707
    15 SEP-12 706
    08 SEP-12 705
    01 SEP-12 704



    everymonth admin will refresh the data table and automatically this table above is updated with unique seq_no and process_date.

    I need extarct min date of everymonth (first 6 months discount - excluding the months perceive) and also the seq_no associated to this month so using joins (using the seq_no - which is available in the main table) I can combine the actual data.

    I need result like:

    March 2, 13 731 (I don't need MAR such that it take no data for the current month)

    so I need final result as below:

    2 FEBRUARY 13 726
    5 JANUARY 13 722
    DECEMBER 8, 12 718
    NOVEMBER 3, 12 713
    OCTOBER 5, 12 709
    01 SEP-12 704
    select
     min(Process_date) Process_date
    ,min(SEQ_No) SEQ_No
    -- assuming that se_no increases consecutive with the date, otherwise
    -- min(seq_no) keep(dense_rank first order by process_date) seq_no
    from your_table
    where
    process_date < trunc(sysdate,'MM')
    -- if there is data older than 6 months in your table, which is unclear
    -- from your description and the data
    --and
    --process_date >= add_months(trunc(sysdate,'MM'), -6)
    group by trunc(process_date,'MM')
    order by process_date desc
    

    Published by: chris227 on 25.03.2013 03:00

    Published by: chris227 on 25.03.2013 03:03

  • Get surveys using filtered with the ID (space) data control manager surveys

    Hi all

    I need to get surveys using surveys Manager DataControl a space specific webcenter. I did not find any function under the control of data for surveys Manager for passing the scopeId as argument parameter.

    Is it possible to filter the polls based on the id of the scope?

    Can someone help me?

    Kind regards
    Suma

    According to the documentation.

    http://docs.Oracle.com/CD/E17904_01/WebCenter.1111/e10148/jpsdg_polls.htm#CIHIIJHG

    There is no scope ID to filter the polls based on spaces.

    But in any case, to achieve your desired goal, I would say that...

    Create surveys Mutiple (surveys) and on each Survey (Polls) you can have questions to take the poll.

    Thus,.

    Space 1-> 1-> Question 1 survey

    Space2-> eurobarometre2-> issue 1

    Space3-> poll3-> Question 1.

    All by posting the question you can use take survey taskflow or datacontrol where you will need to provide a SURVEY_ID in the pollId parameter.

    I hope that clarfiies your request.

    Kind regards
    Hoque

  • Get the name of data file of sqlldr map using OMB

    I am able to get a card SQLLDR to the SRC file, but unable to get file name of data, details are given as under:

    OMBRETRIEVE MAPPING 'A' SOURCE_DATA_FILE GET
    tony_src

    OMB + > OMBRETRIEVE MAPPING 'A' SOURCE_DATA_FILE 'tony_src' GET DATA_FILE_NAME
    OMB02932: Error getting child objects of type DATA_FILE_NAME has

    Thanks in advance!

    Hello

    On the top of my head, try...
    OMBRETRIEVE MAPPING 'A' SOURCE_DATA_FILE 'tony_src' GET PROPERTY (DATA_FILE_NAME)

    See you soon
    David

  • When zoomed in on a waveform graph, how can I get all of the data points that is currently displayed on the graph?

    I use X-zoom tool on the graphic palette. In this chart, the x-axis are time. Thus, for example, if I have 30 seconds displayed on the x-axis of the complete graph, and I want to zoom in on the Middle 10 seconds, how can I get the axis y data points that correspond to this average 10 seconds?

    Similar to Cory's suggestion, could you use the X - Scale-> range-> the Min and Max properties to retrieve the appropriate data?

    Maybe even link your sweater of data for the range of scale change event?

  • Query to get the time MIN

    Hi all.

    How can I get rank with MIN time (DESPITE DAY) (for the first six hours 08:00-14:00, AND the NEXT 6 hours 14:01 to 20:00)
    If what follows is my sample
    03/05/2012 17:30:00
    04/05/2012 17:00:00
    10/05/2012 18:00:00
    12/05/2012 08:00:00
    10/05/2012 07:00:00  
    03/05/2012 11:00:00  
    my result should be at first six hours 07:00 and 17:00 followed by six)


    Thanks in advance for any help

    Personally, I do not like to convert dates into strings and vice versa. I think that both arithmetic and precise the date date would perform better.

    Here's an alternative:

    with t as (
      select to_date('03/05/2012 17:30:00','DD/MM/YYYY HH24:MI:SS') as dt from dual union all
      select to_date('04/05/2012 17:00:00','DD/MM/YYYY HH24:MI:SS') from dual union all
      select to_date('10/05/2012 18:00:00','DD/MM/YYYY HH24:MI:SS') from dual union all
      select to_date('12/05/2012 09:00:00','DD/MM/YYYY HH24:MI:SS') from dual union all
       select to_date('10/05/2012 08:30:00','DD/MM/YYYY HH24:MI:SS') from dual union all
      select to_date('03/05/2012 11:00:00','DD/MM/YYYY HH24:MI:SS') from dual
    )
    select to_char(min(dt) keep (dense_rank first order by dt-trunc(dt)), 'HH24:MI:SS') hh24miss
    from t
    group by trunc((extract(hour from to_timestamp(dt))-2)/6)
    order by 1;
    
    HH24MISS
    --------
    08:30:00
    17:00:00
    

    Explanation:

    -Use the EXTRACT function to get the time. The date must be "converted" in a timestamp date because ANSI does not have the component "hour".
    -Subtract the difference of two hours from the time. This will change the interval from 2-8 to 0-6, 8-14-6-12, etc.
    -Divide by 6 and truncates the result. This will give 1 what it is from 08:00 to 13:59.59 hours.
    -Group by this result, which will all split into groups of ranges of 6 hours.

    -Now, in each group, so the component "hour": TRUNC (DT) is the date with time set to 0, DT - TRUNC (DT) is the component "hour".
    -Ordering by the component "hour", download the first date that corresponds to the first component of the time.

    Published by: stew Ashton on November 16, 2012 17:38

  • Using the data logged in an interface with the aggragate function

    Hello

    I'm trying to use logged data from a source table in one of my interfaces in ODI. The problem is that one of the mappings on the columns target implies a function (sum) overall. When I run the interface, I get an error saying not "a group by expression. I checked the code and found that the columns jrn_subscriber, jrn_flag, and jrn_date are included in the select statement, but not in the group by statement (the statement group contains only remiaining two columns of the target table).

    Is there a way to get around this? I have to manually change the km? If so how would I go to do it?

    Also I'm using Oracle GoldenGate JKM (OGG oracle for oracle).

    Thanks and really appreciate the help

    Ajay

    "ORA-00979"when the CDC feature (logging) using ODI with Modules of knowledge including the aggregate SQL function works [ID 424344.1]
    Updated 11 March 2009 Type status MODERATE PROBLEM

    In this Document
    Symptoms
    Cause
    Solution
    Alternatives:

    This document is available to you through process of rapid visibility (RaV) of the Oracle's Support and therefore was not subject to an independent technical review.

    Applies to:
    Oracle Data Integrator - Version: 3.2.03.01
    This problem can occur on any platform.
    Symptoms
    After successfully testing UI integration ODI using a function of aggregation such as MIN, MAX, SUM, it is necessary to implement change using tables of Journalized Data Capture operations.

    However, during the execution of the integration Interface to retrieve only records from Journalized, has problems to step load module loading knowledge data and the following message appears in the log of ODI:

    ORA-00979: not a GROUP BY expression
    Cause
    Using the two CDC - logging and functions of aggregation gives rise to complex problems.
    Solution

    Technically, there is a work around for this problem (see below).
    WARNING: Problem of engineers Oracle a severe cautioned that such a type of establishment may give results that are not what could be expected. This is related to how ODI logging is applied in the form of specific logging tables. In this case, the aggregate function works only on the subset that is stored (referenced) in the table of logging and on completeness of the Source table.

    We recommend that you avoid this type of integration set ups Interface.
    Alternatives:

    1. the problem is due to the JRN_ * missing columns in the clause of "group by" SQL generated.

    The work around is to duplicate the knowledge (LKM) loading Module and the clone, change step "Load Data" by editing the tab 'Source on command' and substituting the following statement:
    <%=odiRef.getGrpBy()%>

    with
    <%=odiRef.getGrpBy()%>
    <%if ((odiRef.getGrpBy().length() > 0) && (odiRef.getPop("HAS_JRN").equals("1"))) {%>
    JRN_FLAG, JRN_SUBSCRIBER, JRN_DATE
    <%}%>

    2. it is possible to develop two alternative solutions:

    (a) develop two separate and distinct integration Interfaces:

    * The first integration Interface loads the data into a temporary Table and specify aggregate functions to use in this initial integration Interface.
    * The second integration Interfaces uses the temporary Table as Source. Note that if you create the Table in the Interface, it is necessary to drag and drop Interface for integration into the Source Panel.

    (b) define the two connections to the database so that separate and distinct references to the Interface of two integration server Data Sources (one for the newspaper, one of the other Tables). In this case, the aggregate function will be executed on the schema of the Source.

    Display related information regarding
    Products

    * Middleware > Business Intelligence > Oracle Data Integrator (ODI) > Oracle Data Integrator

    Keywords
    ODI; AGGREGATE; ORACLE DATA INTEGRATOR; KNOWLEDGE MODULES; CDC; SUNOPSIS
    Errors
    ORA-979

    Please find above the content of the RTO.
    It should show you this if you search this ID in the Search Knowledge Base

    See you soon
    Sachin

  • IPhone-to-iPad call phone cellular continuity uses the data

    Many times I drive to work using my iPad Mini 4 WiFi + cell phones driving to work to play music of different applications via bluetooth to my car audio system.

    Whenever my phone rings, my iPad has the T-Mobile (my support for iPhone & iPad) also allows cellular continuity. My question is, if I were to answer the call on my iPad I will be charged data or the call still counts against cellular minutes? So, basically the iPad use VoIP (data) or VoLTE (phone calls / minutes) to manage the call? Thanks for any help!

    Updated - talked with my contact at T-Mobile, who is Advisor senior technical/engineering. He said phone calls on iPad via transfer cell/continuity is currently working on Facetime Audio that is essentially a VoIP service and use the cell data.

    However, T-Mobile is looking for ways to eliminate the use of data for its customers on Facetime Audio (and perhaps even Facetime video as well) through their programs free music and frenzy on. If that happens, it would be incredible!

  • guys, how can I stop backup during I use cellular data

    guys, how can I stop backup during I use cellular data

    iCloud backup requires a wi - fi connection. It does not backup when only cellular data are available. See: get help from backup of your device in iCloud - Apple Support

  • I can't get my Mac Mini from Yosemite 10.5.5

    I have a Mac Mini running 10.5.5 2011 end quite happy.  I bought a 2 trackpad, but El Capitan need to get full use, so I downloaded 10.11.4 successfully.  But when I try to install I get the message: the attention of this update requires OS X version 10.11.  I could not find 10.11.0, but I downloaded 10.11.2 and had the same alert.  Then I tried to download Snow Leopard 10.6.8 and got: the attention of this update requires OS X version 10.6.  I can't believe that it is necessary to download every single update to get the latest version.  Clearly there is something wrong with my Mini (works perfectly), but I have not a clue about where to look or what to do.  Can someone help me?

    It is not possible for a 2011 mini Mac running 10.5.5 outside an emulator. If your computer is compatible with El Capitan, you need to buy a Snow Leopard DVD, update 10.6.8 and then get El Capitan from the Mac App Store.

    (141521)

  • Use of data excessive mobile (cellular data) of Documents &amp; Sync

    I had a problem during the last 3 or 4 days of my iPhone using excessive amounts of mobile data.

    Typically, in a month, I use about 3 GB of data. In the last 4 days I used more 2 GB despite spending most of the time in places with WiFi.

    Once I realized that something was up (when I had to buy updates data in 72hrs 2 x 1 GB). I started to look for a cause by using the data provided under settings > Mobile Data (cellular data).

    Tried a couple of things:

    (1) under settings > iTunes & App Stores "use mobile data" has been attributed to.

    It was weird, I'm pretty sure the last time I checked it was off. In any case, I changed it to off.

    Under data Mobile > System Services, I could see the data used by iTunes had fallen back. This has helped reduce the use of data, but has not solved the problem.

    (2) under settings > iCloud > iCloud Drive 'use mobile data' has been assigned to.

    Didn't know it, but he found Googling for a solution. I changed it to off. Makes very little difference.

    After making these changes I switched back on Mobile Data. I always saw use of massive data, about 50 MB in 30 minutes.

    When I checked in Mobile Data > Services system by far the largest user of data is listed as 'Documents & Sync '. I don't know what it does.

    I signed up for my iCloud on the phone. This sewing to help, but I couldn't leave it that way for a long time, because missed me my calendar and contacts so I signed in and turn all my iCloud (except mail) services.

    So, as soon as now I have dial-up mobile data wide completely. I'm only able to use my phone on WiFi, so it is essentially a super expensive iPod Touch.

    I really need help with this, I hope someone can tell me please a solution or at least explain what might use data labeled as «Documents & Sync»

    If I can't get to the bottom of it I'll have to switch to another phone, my career here in New Zealand do not offer unlimited plans :-(

    Some details on my phone and the settings:

    • iPhone running iOS 9.2.1 6 (13D 20)
    • Phone has 128 GB of storage with about 10 GB of free space
    • iCloud, I use it for everything except the storage of email and document
    • I have iTunes game, Apple Music/subscriptions
    • iCloud library is running
    • All I can find with a setting for her except for Apple's music is set to use only data on WiFi

    An update.

    It has been suggested that I have disable Wi - Fi pass to see if that would help.

    I ran several tests. This apparently made no difference.

    Tests in 15 minutes will help the periods that I sometimes see very low use with WiFi help on & I see still on a very high, sometimes use 4G data and WiFi turned off.

    Worst when I was walking with WiFi and 4G data but WiFi help out I've seen data use of 39.5 MB in 15 minutes, this 35.1 MB was allocated the mysterious return «data & Sync»

    Test details:

    Test 1.

    local time 10:00-10:15.

    • WiFi off
    • 4 G Mobile Data on and connected with good signal
    • Assist off WiFi
    • Changing the mode of the aircraft at the beginning of the test
    • Stationary situation during the test

    Total mobile data use 1.4 MB

    (Documents & Sync 3.2 KB)

    Test 2.

    local time 10:30-10:45.

    • WiFi on and connected with good signal
    • 4 G Mobile Data on and connected with good signal
    • Assist of WiFi on
    • Changing the mode of the aircraft at the beginning of the test
    • Stationary situation during the test

    Use of mobile data total 57.8 KB

    (Documents & Sync 2.1 KB)

    Test 3.

    local time 13:00-13:15.

    • WiFi off
    • 4 G Mobile Data on and connected with good signal
    • Assist off WiFi
    • Changing the mode of the aircraft at the beginning of the test
    • Stationary situation during the test

    Total mobile data use 9.0 MB

    (Documents & Sync 28.6 KB)

    Test 4.

    local time 13:20-13:35.

    • WiFi on but not connected to a constant signal
    • 4 G Mobile Data on and connected with good signal
    • Assist off WiFi
    • Changing the mode of the aircraft at the beginning of the test
    • Mobile location (market) during the test

    Total mobile data use 39.5 MB

    (Documents & Sync 35.1 MB!)

  • How will I know if I am being charged for the use of data on the mini2 ipad

    How will I know if I am to be charged or billed for usage on my ipad mini data 2?

    Hello

    You can be charged for the use of data on an ipad, if it has a SIM card

    Cellular data.

    If your home wifi is unlimited you will not be charged more.

    Unless your WiFi has a hat of data ie download limit.

    See you soon

    Brian

  • I can't use Microsoft dates. He tells me to "Install ActiveX control" BUT

    I have everything that I can't use Microsoft dates.  He said "Install ActiveX control" but the instructions or take the following steps to solve the problem is to work for me.  I had the bulk of security installed for some time, but my PC is really slow and stop the little pop ups of what risk etc occur.  I ran the security scan, microsoft set the scan, the malicious software removal tool and the free antivirus, antispyware and they all return that there is no problem.  I need to get the ActiveX control Setup so I can receive all the dates at the top.  Can some one please give me advice on how to do it.  Thank you very much in advance, Ms. ESP :>)

    Is this the same computer as in this thread more early of yours? -Online http://answers.microsoft.com/en-us/ie/forum/ie8-windows_xp/getting-webpage-error-details-user-agent-pop-up/a09f3911-5e9d-4176-86d6-55edf1d78a9e

    And this one? -Online http://answers.microsoft.com/en-us/protect/forum/protect_scanning/my-windows-online-scranner-window-just-appeared/b1a41787-0658-44fe-b6be-66ce46316215

Maybe you are looking for

  • HP Pavilion x 2 10-n011nl (Suns: laptop locked after upgrade windows 10)

    Two days ago, I bought a HP Pavilion x 2 (red sunset) 10-n011nl and immediately I started upgrading Windows 10. This medication is ok (no error message), but the first new starting system, the machine is in a loop! Only a black screen with white logo

  • error "WindowsUpdate_800F080D" "WindowsUpdate_dt000"

    Tried to install update KB951847. NEt framework SP1 update and received this message.This is the second time that this has happened

  • Volume is available in safe mode

    I have a windows vista laptop, when I turn on safe mode, I can't get the volume to work, how do I fix (please use a simple language, technical terms just his Dutch for me)

  • BlackBerry 10 can not send emails to someone, not in the contacts list

    Brand new here and searched this forum and elsewhere for this problem, but the gaps came. I got my Z10 launch day at the Canada and he likes most of the time. Most of the questions I had were actually lack of Telus. (Implemented my Telus email accoun

  • Lock the workspace

    I am completely happy with my workspace like this. Is it possible to lock the workspace to avoid by inadvertence/disconnection of the panels and the window document? 99 / 100 times of any change in my workspace is involuntary - most often try to drag