Generating date records based on a start_date and end_date

Hello,
I am looking for a pure sql solution for the following scenario. I tried some of other suggested methods, but couldn't get it to do I wanted.
Here is the detail of the sql I need.
A existing table has the following.
Patient id First Visit Date Last Visit Date
1111 Jan 1, 2008 Jan 08, 2008
1112 Jan 15, 2008 Mar 10, 2008
1130 Mar 10,2007 Mar 15, 2007
Now I need to generate following output from a sql query to be joined with another sql later.
Dates fields could be of any date format. This has to be a pure sql solution without the use of any temp tables.
Patientid Patient Dates
1111 Jan 1, 2008
1111 Jan 2, 2008
1111 Jan 3, 2008
1111 Jan 4, 2008
1111 Jan 5, 2008
1111 Jan 6, 2008
1111 Jan 7, 2008
1111 Jan 8, 2008
1130 Mar 10, 2007
1130 Mar 11, 2007
1130 Mar 12, 2007
1130 Mar 13, 2007
1130 Mar 14, 2007
1130 Mar 15, 2007
Your help is appreciated.
Thanks,
Pasha

The dates you mentioned as hardcoded are simply put to represent your data. In the following example you can simply omit all before the line with comments and look, whether you get desired results ( however, simply join your table with any big table is the most simple (and easiest to read) solution in my opinion)
SQL> with pat_visit as (
  2    select 1111 patientid,date '2008-01-01' dt_dov from dual union all
  3    select 1111,date '2008-01-08' from dual union all
  4    select 1130,date '2008-03-10' from dual union all
  5    select 1130,date '2008-03-15' from dual
  6  )
  7  -- end test data
  8  select dov.patientid, to_char(dov.mind + (level - 1),'DD-MON-YYYY') my_date
  9  from
10  (select patientid, max(dt_dov) maxd, min(dt_dov)mind from pat_visit
11  group by patientid) dov
12  connect by prior patientid = patientid
13         and prior dbms_random.value is not null
14         and level <= maxd - mind + 1
15  ;
PATIENTID MY_DATE
      1111 01-JAN-2008
      1111 02-JAN-2008
      1111 03-JAN-2008
      1111 04-JAN-2008
      1111 05-JAN-2008
      1111 06-JAN-2008
      1111 07-JAN-2008
      1111 08-JAN-2008
      1130 10-MAR-2008
      1130 11-MAR-2008
      1130 12-MAR-2008
      1130 13-MAR-2008
      1130 14-MAR-2008
      1130 15-MAR-2008
14 rows selected.Best regards
Maxim

Similar Messages

  • Problem with Data recording with EPOS2 24/5 and LabVIEW

    Dear community memebers,
    I've been trying some examples from EPOS library, and I would like to know how this example works and how data recording works.
    Idon'tknowwhatdoestheparameters, thatthereareindecircle, means.
    I would like to plot Position, Velocity and Acceleration. Has someone can explain me how does it works? and what is the funcion of the numbers in the cluster?
    Thanks.
    Best Regards,
    Xavi
    Solved!
    Go to Solution.
    Attachments:
    EPOSLibrary.llb ‏4870 KB

    Hi Xavi,
    you should ask Maxon to explain their software. Or read the manuals they provide...
    Motors with some logic usually use a register based communication scheme. You write to certain register to set parameters, you read certain registers to know current parameters/values of the motor. Each cluster in that array is describing one of those registers/parameters, like the first one with register address x6064, sub-address x0 and value d4. Those parameters seem to resemble CANopen CiA specifications!
    I can't open that VI due to it's LabVIEW version, but probably you will find labels on the input control of that subVI. Read the labels...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Generating RSA keys based on p, q, and public exponent

    Hi,
    The problem is the following. I need to generate an RSA key pair on the card based on pre-defined P, Q and public exponent. The KeyPair specs syas that if the public exponent is pre-initialized it will be retained. All other values are overwritten though (I checked with a test applet on jcop41). So two questions:
    1. Do you know of any card that can also retain p and q and generate (calculate) dp, dq, pq, and public modulus. This is contrary to the specification so I doubt there would be any, but it is always good to ask.
    2. Do any of you have a Java code that would do this (ie. calculate the missing key components) that can be run on Java Card, ie. does not use BigInteger or similar classes.
    Cheers,
    Woj

    That is exactly the point I was trying to make, I actually forgot about this thread, because the problem at hand went on the shelf for the moment. To reformulate:
    1. I have only certain parts of the RSA key, but enough parts to determine a valid private/public key pair.
    2. Now I want to generate the missing parts on the card. The JC API requires all the parts to be supplied, it is not possible to provide only partial (but determining the whole key) key information. The KeyPair class can only retain the public exponent during key generation, but not the other parts (according to the specs and my own tests).
    3. My wild guess is that it would probably be doable without too much hassle with host JCE, but it's not an option for me, it has to be done on the card.
    4. I could try to write my own Java Card code that would do this based on, say, openssl implementation, but now I am too lazy, so that's why I asked if somebody possibly has the code that does this.
    Cheers,
    Woj

  • How to display records based on current month and last month???

    i have a query that want to display the data for current month and last month. when i try to view the reports, all the data/key figures is return all in 0.00.
    i modify the variables for this current month and last month but still the results is the same. i could not see the data. any advise on how to modify the variables for this current month and last month? i am thinking my variables is wrong.
    for the current month variable:
    the type of variable is characteristic value, processing by customer exit, reference characteristic is calendar year/month.
    thanks for all who are kind to help me here....

    Hi,
       If you install the variables from BC correctly and they are in active state, you can use them directly use them. check for this month the total values at info cube is ZERO or some value. as you told you are getting ZEROS for your input.and check the data at cube level based on your query design, apply all restrictions, fileters and see do you get any data at cube level and compare with report.

  • Generating a report based on two analytics(for ex:PO and PR)

    I have a question regarding generating reports on two analytics.
    In our scenarios,
    We need to generate a report based on Purchase order and Purchase request.Is it possible in OBIA?
    if yes,please provide the solution.
    Thanks in advance

    Hi ,
    Thanks for your valuable time.
    We are in designing phase of the project. we need to know ,Is there any inbuilt dashboards or reports built using both PO and PR repositories?
    I would like to explain with ex:
    Let's say we need a report or dashboard containing few fields from PO and few fields from PR.Let's assume both PO and PR data available at same granularity.
    Do we have any such inbuilt reports or dashboard?
    If not,could we customize the report generation using both PO and PS tables?
    Please provide the solution.
    Thanks in advance.
    Edited by: user3561029 on Aug 31, 2008 9:03 PM

  • How to see the data records for a dso based upon the request id?

    Hi all,
    How to see the data records based upon the request id on the dso.
    I need to see the data for a dso based upon the request id 444493 loaded from another dso through repair full update.
    thanks

    Hi,
    Step 1: select your request from DSO request tb
    Step 2: Select your DSO just above your contents/requests/reconstruction tabs
    Step 3: Click contents(Spectacles symbol) in the top area of your screen
    Step 4: Slect the required fields
    Regards,
    Suman

  • How to create a record based on the name of a file in the file-system?

    Hi,
    With a lot of pictures I want to have a database to gather some information about these pictures.
    First question is how to generate a record based on a file in the file system?
    e.g. the pictures are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg" .
    now i want to create records with as one of the attributes the name of the picture (not the picture itself). how to create these records (based on the information of the file-ssytem). i.e. the number of records should be the same as the number of pictures.
    any suggestions?
    any reaction will be appreciated.
    Leo

    Link to Create directory
    http://www.adp-gmbh.ch/ora/sql/create_directory.html
    You can create a list of files in the directory and read the list files from that directory.
    [UTL_FILE Documentation |http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]
    [Solution using Java|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584]
    SS

  • Generating Dates Between Date Range

    Hi,
    I have a table with test_id, a_id, start_date, end_date like the below.
    test_id a_id start_date end_Date
    861 2123 05-Dec-2009 10-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009
    I need to generate dates between the start_date and end_date like the below. Kindly help.
    test_id a_id start_date end_Date tdate
    861 2123 05-Dec-2009 10-Dec-2009 05-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 06-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 07-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 08-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 09-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 10-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 06-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 07-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 08-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 08-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 07-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 08-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 09-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 11-Dec-2009
    Please reply at the earliest. Its very urgent. Thanks in advance.
    Regards,
    Gayathri Devi

    with t
    as
    select 861 test_id, 2123 a_id, to_date('05-Dec-2009','dd-mon-yyyy') start_date, to_date('10-Dec-2009','dd-mon-yyyy') end_date from dual union all
    select 861, 2124, to_date('06-Dec-2009','dd-mon-yyyy'), to_date('09-Dec-2009','dd-mon-yyyy') from dual union all
    select 864, 2123, to_date('08-Dec-2009','dd-mon-yyyy'), to_date('10-Dec-2009','dd-mon-yyyy') from dual union all
    select 864, 2124, to_date('07-Dec-2009','dd-mon-yyyy'), to_date('11-Dec-2009','dd-mon-yyyy') from dual
    select test_id, a_id, start_date, end_date, start_date+no-1 dt
      from t
      cross join
    select level no
      from dual
    connect by level <= (select max(end_date-start_date+1) from t)
    where case when start_date+no-1 > end_date then null else start_date+no-1 end is not null
    order by 1,2,5

  • Data record with time interval error

    Hi,
    I have come across the following error.
    Data record with Time interval error and data is getting loaded into data target and no PSA in between.
    thanks
    kris

    Hi Kris,
    Could you please explain your problem little bit more. I mean what is source and target, or you using IP or DTP.
    goto the details in monitor tab, you will come to know to which record yo uhave error.
    If you are running IP, it is recommended to keep PSA.
    Regards,
    Venkatesh

  • Deadlock when deleting a not linked data record in a parent table

    Hello, who knows about this problem with Oracle 10g:
    Our installation of Oracle 10.2g behaves different from Oracle 9.2 concerning locking of data records:
    To prevent that different users edit a complex data record at the same time and store it, the user has to put
    the data record into the "edit mode" and we lock it with "Select CharFieldZ from TableX where ID = 1 for UPDATE NOWAIT".
    In this data record references (= foreign keys) to other tables are used; with foreign key constraints we
    prevent those data records of these tables from being deleted, which are used in data records of tableX: on
    deleting such a record Oracle gives an error message ORA-02292, which the application translates for the
    user: "You cannot delete this record, because it is used somewhere else".
    Now when locking data record A under Oracle 10.2g, which contains a foreign Key upon data record 1 of tableF,
    and trying to delete data record 2 of tableF, a deadlock appears, even when this data record is not used
    anywhere else.
    Further conditions:
    - Data record 2 was created before locking of data record A.
    - In the same session tableF was opened for reading before.
    Is there a parameter, which leads Oracle 10.2g to return to the former behavoir ?
    or: how is it possible to prevent a deadlock anyhow else ?
    Thanks in advance
    Lothar Weidl-Walther
    Germany
    Edited by: schatzag on 04.02.2009 14:22
    for easier demonstration the SQL-scripts:
    Installation:
    DELETE TableF;
    DELETE TableX;
    CREATE TABLE TableF
    ( ID INTEGER NOT NULL,
    NAME VARCHAR2(30 BYTE) NOT NULL);
    CREATE UNIQUE INDEX PK_TableF ON TableF(ID);
    ALTER TABLE TableF ADD CONSTRAINT PK_TableF PRIMARY KEY(ID);
    INSERT INTO TableF VALUES (1, 'Record1');
    INSERT INTO TableF VALUES (2, 'Record2');
    commit;
    CREATE TABLE TableX
    ( ID INTEGER NOT NULL,
    NAME VARCHAR2(30 BYTE) NOT NULL,
    CharFieldZ VARCHAR2(100 BYTE),
    TableF_ID INTEGER);
    ALTER TABLE TableX ADD (
    CONSTRAINT FK_TableX_TableF
    FOREIGN KEY (TableF_ID)
    REFERENCES TableF (ID));
    INSERT INTO TableX VALUES (1, 'ComplexRecord1', 'User1', 1);
    commit;
    Session1:
    SELECT CharFieldZ FROM TableX WHERE ID = 1 FOR UPDATE NOWAIT;
    SELECT * FROM TableF;
    Session2:
    DELETE FROM TableF WHERE ID = 2;
    Edited by: schatzag on 04.02.2009 14:26

    I'm not aware that the locking mechanism did change between Oracle 9i and 10g. Can you provide a simple and reproducable example?
    You current description is very "uncomplete", e.g. this statement would lock the full table, but I think that is not what your application does.
    Select CharFieldZ from TableX for UPDATE NOWAITAs Peter already mentioned you should check if there are any other differences between the databases. Let me mention just a few points that I can think of at the moment:
    * indexes
    * FK constraints with DELETE CASCADE
    * higher oracle block size (can lead to more ITL locks)
    Edited by: Sven W. on Feb 4, 2009 2:18 PM

  • How to generate individual records out of a date interval in SQL?

    I have the following table in my db:
    group varchar(3), start date, end date, value number
    Obs.: The dates are in the format DD/MM/YYYY
    This table has this single record:
    'group1', 01/11/2007, 15/11/2007, 3
    I need to query this table (using SQL) and generate the following result:
    'group1', 01/11/2007, 3
    'group1', 02/11/2007, 3
    'group1', 03/11/2007, 3
    'group ', 15/11/2007, 3
    Does anybody know how I can produce this output?
    Thank you
    Message was edited by:
    user596855

    > This table has this single record:
    'group1', 01/11/2007, 15/11/2007, 3
    If, at sometime in the future, this table contains more than one record, then the solutions above won't work and you might need a SQL statement like this:
    SQL> create table mytable (groep,start_date,end_date,value)
      2  as
      3  select 'group1', date '2007-11-01', date '2007-11-15', 3 from dual union all
      4  select 'group2', date '2007-11-10', date '2007-11-20', 88 from dual
      5  /
    Tabel is aangemaakt.
    SQL> select groep
      2       , day
      3       , value
      4    from mytable
      5   model
      6         partition by (groep,value)
      7         dimension by (0 i)
      8         measures (start_date day, end_date)
      9         rules
    10         ( day[for i from 1 to end_date[0] - day[0] increment 1] = day[0] + cv(i)
    11         )
    12   order by groep
    13       , day
    14  /
    GROEP  DAY                                                  VALUE
    group1 01-11-2007 00:00:00                                      3
    group1 02-11-2007 00:00:00                                      3
    group1 03-11-2007 00:00:00                                      3
    group1 04-11-2007 00:00:00                                      3
    group1 05-11-2007 00:00:00                                      3
    group1 06-11-2007 00:00:00                                      3
    group1 07-11-2007 00:00:00                                      3
    group1 08-11-2007 00:00:00                                      3
    group1 09-11-2007 00:00:00                                      3
    group1 10-11-2007 00:00:00                                      3
    group1 11-11-2007 00:00:00                                      3
    group1 12-11-2007 00:00:00                                      3
    group1 13-11-2007 00:00:00                                      3
    group1 14-11-2007 00:00:00                                      3
    group1 15-11-2007 00:00:00                                      3
    group2 10-11-2007 00:00:00                                     88
    group2 11-11-2007 00:00:00                                     88
    group2 12-11-2007 00:00:00                                     88
    group2 13-11-2007 00:00:00                                     88
    group2 14-11-2007 00:00:00                                     88
    group2 15-11-2007 00:00:00                                     88
    group2 16-11-2007 00:00:00                                     88
    group2 17-11-2007 00:00:00                                     88
    group2 18-11-2007 00:00:00                                     88
    group2 19-11-2007 00:00:00                                     88
    group2 20-11-2007 00:00:00                                     88
    26 rijen zijn geselecteerd.Regards,
    Rob.

  • Sort all the Records in Data manager based on Update Date

    How to sort the reocrds in Data Manager based on Date or something ?
    And also I have three records for a same customer in ( for three different company codes ) and when I search for this customer with the Customer number then it is showing three records , but when I search with Update Date then no records are fetched ...what is the reason ?

    If you make a field as type "Time Stamp" in your data model using the MDM Console, make sure that the option Sort Index is set to Normal.  If this is the case, whenever a record is updated in the repository, the date will be updated.  If the sort index is normal, then MDM will allow you to sort the records based on the date and time by which they were updated.  You can do this by finding your time stamp field in the MDM data manager and clicking on it.  If there is an up and down arrow next to the name of your field, it means it can be sorted.  Also, to answer your other question, you can definitely search based on date.  Use the Free-Form Search on the left hand side of the data manager at the bottom of the screen.  Simply select a date, and it will show you all the records updated on that date.

  • Forms pulling Multiple Records from an XML Schema and XML data files - Adobe LiveCycle Designer

    I built a form in Adobe LiveCycle with an xml schema and data file.  The problem is with how the form renders the xml data file.
    I have a statement element that consists of about 6 fields (statementID, statementName, statementAddress, statementCountry, statementZip, statementDate, etc) of data in the schema that allows for multiple iterations - so one xml data file can contain multiple statements. These fields allow for null values.
    But here's the problem:  When any of the statements - say statement 2 of 6 - has a null value in one of the fields, if the xml data file doesn't have a placeholder
    (example of placeholder:  <statementName type="String"/>   )in the xml for that field, my form pulls the field value from the NEXT statement.
    This corrupts all the rest of the statement records, as this field is shifted up for all the rest.
    I know that in the past I haven't needed a placeholder when a field was null. But I'm wondering if when the data allows for multiple records the xml data file needs to generate the placeholder.  And where is the problem? In the Schema? The xml data file? My form?  And the 64-thousand-dollar question:  How to fix it?

    If your <statement> element is the one that repeats, it should be bound to a subform with the binding string of something like $.statement[*]. Then in that subform should be your fields and they should have bindings of $.statementID, $.statementName, $.statementAddress, etc.
    Kyle

  • SMS_DISCOVERY_DATA_MANAGER Message ID 2636 and 620. Discovery Data Manager failed to process the discovery data record (DDR)

    Hi
    I'm seeing this critical error on my primary.
    SMS_DISCOVERY_DATA_MANAGER Message ID 2636 and 620. 
    Discovery data manager failed to process the discovery data record (DDR)"D:\Prog.....\inboxes\auth\ddm.box\userddrsonly\adu650dh.DDR", because it cannot update the data source.
    Where these ddr's are actually under ddm.box\userddrsonly\BAD_DDRS folder
    I see a ton of DDR files in that folder. Not sure if I can delete them, so I moved them to a temp folder. AD User discovery keeps generating them.
    Any help ?
    Thanks
    UK
    

    Check the ddm.log file for more information.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • NULL values and Data Control based on Web Service

    One of my ADF control is based on a Data Control created through a web service. Every thing is working fine except the way ADF control is handling the null values return by the web service based data control.
    For example for null columns the web service is sending the following:
    <ns0:beginDate xsi:nil="1"/>
    or
    <ns0:sourceCode xsi:nil="1"/>
    But the corresponding column in my ADF data control is trying to initialize itself using the value ‘[{nil=1}]’. It fails with the following error.
    2006-04-20 13:31:37.510 WARNING JBO-25009: Cannot create an object of type:java.util.Date with value:[{nil=1}]
    I will appreciate if someone could help me resolve this issue.
    Thanks,

    I tried again, but it seems that I'm unable to reproduce this in a test project which uses another data controls but is still as similar as possible to the original project in which I've encountered this behaviour.
    However, using a data control based on the same web service as in the original project, [{nil=1}] appears again instead of emtpy values.
    Is it possible that there is a significant difference in the generated wrapper classes? The underlying PL/SQL is the same (in strucutre) and the corresponding elements in the response XML of the web service are the same in the two cases, always like <ns0:someResponeValue xsi:nil="1"/>, so I don't know how it is possible that I can't reproduce this behaviour.
    A short description of the projects:
    Services/Model:
    I created a PL/SQL funcition in a package that returns a user type object. This return parameter consists of a non-empty string and a null value string. On top of this I created a PL/SQL web service and a data control for that.
    View/Controller:
    A JSF JSP page which has a read-only form showing the return values of the web service.
    Regards,
    Patrik

Maybe you are looking for

  • Problem with burning Ken Burns effect on iDVD

    When I preview a slideshow on iDVD after setting the theme to Ken Burns, it looks great. When I burn the project onto a DVD however the Ken Burns effect disappears and I'm left with static photos. What's going on?

  • Connecting USB cable to new iPad

    Is there a way of connecting a USB cable to my new iPad? I have a device that I want to connect to it but it is only supplied with a USB cable.

  • Need guidance for fusion web developement

    Hi. I am newbie. I am currently using jdeveloper 11. I have surfed a lot of videos about application developement using oracle fusion web development. Can anybody please suggest some really good books/tutorials/videos for my requirement below. 1. The

  • Insight how ascp Order Priority (field Order Priority) is derived ?

    Anyone has detailed information on how ascp assigns "Order Priority" in the Order Priority field in the workbench ? I understand one factor is Priority Rule, but I need more detailed logic behind it. Is this field really meant to tackle the priority

  • Save bookmark with command &CMD=PROCESS_VARIABLES&SUBCMD=VARIABLE_SCREEN

    Hello everbody, I would like to save a bookmark, but with aditional command &CMD=PROCESS_VARIABLES&SUBCMD=VARIABLE_SCREEN. Today, the bookmark have been saved like this: http://rb3dd00a:8001/sap/bw/BEx?SAP-LANGUAGE=P&BOOKMARK_ID=3XPCZNBFV819FY2WYPXKX