Ask at the time of planning

Hi all

I ask your help for my question, I have the following example: (this is already the result of a query in my stored procedure):

time_begin minute descr

Hello

I add the last time of the day in the table. This makes the query more flexible (some days up to 13:00) and on some days up to 16:00

Try this:

-You must include the time of the end of the day.

Insert into student_schedule (TIME_BEGIN, TMINUTE, DESCR) values (to_date (' 2014/11/12 13:00 "," yyyy/mm/dd hh24:mi:ss'), '+ 00:00:00.000000 00', null);

commit;

SELECT

To_char (time_begin, 'yyyy-mm-dd HH24') time_begin

tminute

CASE

WHEN descr IS NOT NULL

THEN descr

WHEN lag (nvl2 (descr, time_begin, NULL) ignores NULL values, 1) over (partition BY order of TRUNC (time_begin) of time_begin) + lag (nvl2 (descr, tminute, NULL) ignores NULL values, 1) over (partition BY order of TRUNC (time_begin) of time_begin) > time_begin

THEN lag (descr ignore NULL values, 1) over (partition BY order of TRUNC (time_begin) of time_begin)

When time_begin = max (time_begin) over (partition by order of TRUNC (time_begin) of time_begin of the lines between the current line and unbounded following)

then "end of the day.

ELSE 'free of charge '.  round ((nvl (to_date (plomb (nvl2 (descr, time_begin, NULL) ignore NULL values, 1) over (partition BY order of TRUNC (time_begin) of time_begin), "yyyy/mm/dd hh24:mi:ss"))))

((max (time_begin) over (partition by order of TRUNC (time_begin) of time_begin of the lines between the current line and unbounded following)) - time_begin) * 24 * 60) | "minutes."

END descr

Of

student_schedule

ORDER BY

time_begin;

TIME_BEGIN TMINUTE DESCR
---------------- ----------- ---------------------------------------------------------
2014-11-12 08:30 0:30:0.0 0 x 1
2014-11-12 08:45 0:0:0.0 0 x 1
2014-11-12 09:00 0:0:0.0 0 free 15 minutes
2014-11-12 09:15 0:45:0.0 0 x 2
2014-11-12 09:30 0:0:0.0 0 x 2
2014-11-12 09:45 0:0:0.0 0 x 2
2014-11-12 10:00 0:0:0.0 0 free for 30 minutes
2014-11-12 10:15 0:0:0.0 0 free 15 minutes
2014-11-12 10:30 0:30:0.0 0 x 3
2014-11-12 10:45 0:0:0.0 0 x 3
2014-11-12 11:00 0:0:0.0 0 free for 45 minutes
2014-11-12 11:15 0:0:0.0 0 free for 30 minutes
2014-11-12 11:30 0:0:0.0 0 free 15 minutes
2014-11-12 11:45 0:15:0.0 0 x 4
2014-11-12 12:00 0:0:0.0 0 free for 60 minutes
2014-11-12 12:15 0:0:0.0 0 free for 45 minutes
2014-11-12 12:30 0:0:0.0 0 free for 30 minutes
2014-11-12 12:45 0:0:0.0 0 free 15 minutes
2014-11-12 13:00 0:0:0.0 0 end of day

19 selected lines

Kind regards

Peter

Tags: Database

Similar Questions

Maybe you are looking for

  • Why the text on my browser is so small?

    I just download Mozilla Firefox on a Windows 8, but for some reason any text in the browser (NOT the actual Web page text) (I mean the menu, titles of tabs bar) is VERY small. I was wondering if there was any means possible to make bigger? I hope you

  • iPhoto 11 crashes when you try to use the slide show

    Hello My iPhoto 11 9.4.3 crashes whenever I try to run a slide show. I have a 2012 end Macbook Pro osx 10.8.5 with all updates of operation. I tried a lot of things. I have several libraries and each the same plant. I created a new library and loaded

  • Cannot install Corel Paint Shop Pro Photo ultimate

    I recently bought Corel Paint Shop Pro Photo ultimate and have not yet been able to install it on my vista machine.  I contacted Corel and the support rep has worked on my machine remotely for more than two hours without success to get the program to

  • Moving/next focus

    Hello I am trying to create a context menu that is customized in the screen. To do this, I have 3 classes: CustomVFM-> extends VerticalFieldManager FileMenuScreen-> extends CustomPopupScreen CustomPopupScreen-> extends to screen I create a CustomVFM

  • BlackBerry smartphone print SMS from phone to the paper size

    Hi this Aileen of South Africa > I have an 8900 and have a large number of sms that I need to print on paper I have BBdesktop Manager on my computer and made backuo etc but when I open the file I can't it says I need to download files. I try and do t