SQL to get the Monday of each week of IW in one year!
Hello!It's an SOS :) I had to get a request to give me every Monday a week IW in one year. I think that depending on the weeks IW it about 52.1 weeks in a year ago. So, basically, I want the departure on Monday of each week. I then store these values in a variable and use it in APEX as column headings. Online, I've seen a few samples not associated not with that, but where the closure was done using the object. Not sure if this is the right approach.
The problem is since it is not stored in a table, how can I loop as 52/53 times such that the output every Monday (date format) for a given year. Basically, the output would be 52/53 rows with a date (Monday).
Help, please!
Thank you
Sun
Published by: ryansun on June 28, 2012 23:09
It would be something you are looking for?
SQL> variable yr number
SQL> exec :yr := 2015
SQL> with dates as (
2 select to_date('0101'||:yr,'ddmmyyyy')-4+level da
3 from dual
4 connect by level < 373
5 )
6 select :yr iyyy, to_char(da,'IW') iw, da monday
7 from dates
8 where to_char(da,'dyiyyy', 'nls_date_language=american')='mon'||:yr
9 ;
IYYY IW MONDAY
---------- -------- ----------
2015 01 29-12-2014
2015 02 05-01-2015
2015 03 12-01-2015
2015 04 19-01-2015
2015 05 26-01-2015
2015 06 02-02-2015
2015 07 09-02-2015
2015 08 16-02-2015
2015 09 23-02-2015
2015 10 02-03-2015
2015 11 09-03-2015
2015 12 16-03-2015
2015 13 23-03-2015
2015 14 30-03-2015
2015 15 06-04-2015
2015 16 13-04-2015
2015 17 20-04-2015
2015 18 27-04-2015
2015 19 04-05-2015
2015 20 11-05-2015
2015 21 18-05-2015
2015 22 25-05-2015
2015 23 01-06-2015
2015 24 08-06-2015
2015 25 15-06-2015
2015 26 22-06-2015
2015 27 29-06-2015
2015 28 06-07-2015
2015 29 13-07-2015
2015 30 20-07-2015
2015 31 27-07-2015
2015 32 03-08-2015
2015 33 10-08-2015
2015 34 17-08-2015
2015 35 24-08-2015
2015 36 31-08-2015
2015 37 07-09-2015
2015 38 14-09-2015
2015 39 21-09-2015
2015 40 28-09-2015
2015 41 05-10-2015
2015 42 12-10-2015
2015 43 19-10-2015
2015 44 26-10-2015
2015 45 02-11-2015
2015 46 09-11-2015
2015 47 16-11-2015
2015 48 23-11-2015
2015 49 30-11-2015
2015 50 07-12-2015
2015 51 14-12-2015
2015 52 21-12-2015
2015 53 28-12-2015
53 rows selected.
Tags: Database
Similar Questions
-
get the length of each string in a column
Hi all
Is there a way to get the length of each string in a column:
for example:
If the table contains lines like below:
Select 'test test1 test31' col1 of double
Union of all the
Select 'sectest1 sectest234' double col1
The output should be as below:
col1
------------
4 5 6
8 10
That is to say get the count of each separated from the chain of space in a column. Is this possible using regexpr_substr?
Thanks in advance.
Roy.
Try the below
SELECT LISTAGG(val1,' ') IN ONE GROUP)
New_val ORDER BY lvl)
Of
(SELECT LENGTH (REGEXP_SUBSTR (col1,'[^] +', 1, LEVEL)) val1,)
RN,
LEVEL lvl
Of
(SELECT col1,
ROWNUM rn
Of
(SELECT 'test test1 test31' col1 OF double)
UNION ALL
SELECT 'sectest1 sectest234' double col1
)
)
CONNECT BY LEVEL<= regexp_count(col1,'="">=>
AND PRIOR rn = rn
AND PRIOR DBMS_RANDOM. VALUE IS NOT NULL
)
GROUP BY rn;
OUTPUT:-
=======
col1
----
4 5 6
8 10
Thank you
Ann
-
Get the Parent for each record in the child
Dear Experts,
I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.
Table: relationship
Parent of the child
102 101
103 102
104 103
106 105
107 106
109 108
110 109
Output:
Expected child
102 101
103 102; 101
104 103, 102, 101
106 105
107 106; 105
109 108
110 109
Thank you very much
Hello
MU * 443499 * TR wrote:
Dear Experts,
I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.
Table: relationship
Parent of the child
102 101
103 102
104 103
106 105
107 106
109 108
110 109
Output:
Expected child
102 101
103 102; 101
104 103, 102, 101
106 105
107 106; 105
109 108
110 109
Thank you very much
Why do you want to
Expected child
----- ---------------
110 109
Instead of
Expected child
----- ---------------
110 109; 108
?
You may want something like this:
CONNECT_BY_ROOT SELECT AS children
SYS_CONNECT_BY_PATH (parent, ';') AS expected_output
FROM table_x
WHERE CONNECT_BY_ISLEAF = 1
CONNECT BY child = parent PRIOR
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
-
How get the text of each paragraph when a textStyleRange is made of texts to multiple paragraphs
Hello
Always on my account findText. The result is sometimes as a textStyleRange which contains the texts of multiple paragraphs. What is the best (and easy) way to get the text of each paragraph individually?
Example: The result of an italic findText with the following extract gives me "saectur quatur? " " Ipsapidunte our" as a unique textStyleRange (correct) but I want to get the text of each paragraph.
Is there a way to force the findText in the paragraphs and not those of them and if not, how to cut the textStyleRange in 2 texts?
-----------------------
Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus repratur molorio enis modi sumquibus nostemquam and volorum facidunti nonseditati re a dolut dolorest ab idipitem saectur quatur?
Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus nostemquam repratur molorio enis modi sumquibus and re volorum facidunti nonseditati a saectur dolut dolorest ab idipitem quatur?
There are two solutions:
(1) you could be formatted every paragraph with formatting marks that you know doesn't exist anywhere else. In this way, each textStyleRange is guaranteed to end at the end of the paragraph.
(2) you can access the entire first paragraph: myTextStyleRange.paragraphs [0]. I have not tested, but no doubt it works. You could also do a loop: paraLength = myTextStyleRange.paragraphs.length; for (i = 0; i< paralength;="" i++);="" mypara="myTextStyleRange.paragraphs[i];}">
-
multiple-join: get the value of each participant
In the multiple join, the studio and independent do not allow to define the inside interactive activity can be suspended. Is there another way to put it can be suspended?
If the instance has 5 copies and each is sent to different participants, how to get the value of each user?
Quantity of copies to wait to release the default value is 0. What it means?Forget not the only multiple makes copies. The main forum is a copy, it remains as it was before the Multiple. And the join does not know how to merge magically all the data of each copy in the main forum. It takes that code as well in the join. Otherwise, your main instance will remain intact.
If I understand your example, you're not updating the values of the instance variables of your main instance, only copies.
If you want to get a number that corresponds to the sum of all values sent by all participants in the Multiple, you must make the amount inside the join:
This.var2 = this.var2 + copy.var1;
(don't forget to initialize var2 in the primary instance)In this way, whenever a copy arrives at the join, var2 is added the value typed in the participant of this particular copy.
I hope that helps!
-
Get the number of month, week and day between 2 dates
Hi all
Is it possible to display the number of months, weeks and days between 2 dates? by using only the SQL or PL/SQL...
Entry:
Date: October 1, 2010
Date: October 19, 2010
I want output like below (assuming starts the week from Monday to Sunday in oracle).
October 1, 2010-(since it's in the middle of the week)
October 2, 2010-(since it's in the middle of the week)
October 3, 2010-(since it's in the middle of the week)
40. (4 Oct-10 Oct falls into the 40th week of the year)
41. (11 Oct-17 Oct falls into the 41st week of the year)
October 18, 2010-(since it's in the middle of the week)
October 19, 2010-(since it's in the middle of the week)
Note: If there is a month between the date, the number of the month should be displayed.
End of the month, the remaining date included with a full week, then the week of the year number should
displayed. After posting the week, remaining dates should be displayed as it is...
Appreciate your help...
Thank you.
Fox.You mean something like this...
SQL> ed Wrote file afiedt.buf 1 WITH t AS (select date '2010-09-27' as fdate, date '2010-11-21' as tdate from dual) 2 -- 3 -- END OF TEST DATA 4 -- 5 select dt2 6 from ( 7 select dt, 8 case when days_of_mn = days_in_month then 'Whole: '||to_char(dt,'Month') 9 when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW') 10 else to_char(dt, 'DD-fmMonth-YYYY') 11 end as dt2 12 ,row_number() over (partition by 13 case when days_of_mn = days_in_month then to_char(dt,'Month') 14 when days_of_wk = 7 then 'Week: '||to_char(dt,'fmWW') 15 else to_char(dt, 'DD-fmMonth-YYYY') 16 end order by dt) as rn 17 from ( 18 select dt, wk, mn, days_in_month 19 ,count(*) over (partition by wk) as days_of_wk 20 ,count(*) over (partition by mn) as days_of_mn 21 from ( 22 select fdate+rownum-1 as dt 23 ,to_number(to_char(fdate+rownum-1,'fmWW')) as wk 24 ,to_number(to_char(fdate+rownum-1,'fmMM')) as mn 25 ,to_number(to_char(last_day(fdate+rownum-1),'fmDD')) as days_in_month 26 from t 27 connect by rownum <= tdate-fdate+1 28 ) 29 ) 30 ) x 31 where rn = 1 32* order by dt SQL> / DT2 ----------------- 27-September-2010 28-September-2010 29-September-2010 30-September-2010 Whole: October Week: 44 Week: 45 Week: 46 19-November-2010 20-November-2010 21-November-2010 11 rows selected. SQL>
-
SQL Server, get the event ID 10016 hourly
Hi guys,.
We get the error message below on our SQL with OS WS2012 server every hour.
"The application-specific permission settings do not grant permission to local Activation for the application server COM with the CLSID.
{FDC3723D-1588-4BA3-92D4-42C430735D7D}
and APPID
{83B33982-693D-4824-B42E-7196AE61BB05}
the user NT SERVICE\SQLAgent$ IBSQL2012 SID (S-1-5-80-485265429-2350460967-4062759752-2586802043-2488535659) from address LocalHost (using LRPC) running in the container of the application unavailable SID (not available). This security permission can be modified using the Component Services administrative tool. »
I have been through a few threats and read it from another post on the internet, but under Component Services, tab of the particular service related to this message (based on its APPID) I see that SYSTEM is already added and it has the Launch Local and local Activation permissions granted to the security.
Why are we always get that number, because instead of local authorities, we should give remote "..." from LocalHost (using LRPC) address... » ?
All thoughts
MCG
Ask the question in the SQL Server forums:
http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer -
subquery to get the results on each side of the result of the query
I need to get the part numbers that are 2 above and 2 below the room number of the authenticated user. I know well enough the enclosed code would not work, but it's the idea of what I want to do. The upper part of the query gives me the number of the person that is authenticated to the room, and then I need to retrieve all the room numbers that fall between 2 on each side of him. In other words, if the user is in room 110, I need all the people in the room 108, 109, 111, 112 (and Prépliez 110). Yet I am not skilled enough to get this correct query. It's MySQL, if that makes a difference.Select the user ID, fname, lname, dorm, room
of p1 psr_subjects join psr_subjects on p1.dorm = p2.dorm p2where p1.username = something
and p2.room <> p1.room
and p2.room between p1.room 2 and p1.room - 2 -
SQL to get the average timestamp between 2 stamps
I know similar question has been asked several times in several forums. Most of them deals with the recovery of interval or a difference between the timestamps in figures (hours, minutes,...) or by using PL/SQL or custom functions.
Without using PL or custom functions, but just a sql, which is the most effective way of the timestamp of calculation which is in between 2 timestamps?
ALTER session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS ";
Select
TO_DATE ('2013-12-05 04:30:20 ',' YYYY-MM-DD HH24:MI:SS') start_date,
TO_DATE ('2013-12-06 15:00:30 ',' YYYY-MM-DD HH24:MI:SS') end_date.
"avg_date
Double;Thank you
Srinivas - y.
in-house dates (and tiemstamps) are just number, then you can simply add half the difference between the dates of the start_date:
Select to_date ('2013-12-05 04:30:20 ',' YYYY-MM-DD HH24:MI:SS') start_date
, to_date ('2013-12-06 15:00:30 ',' YYYY-MM-DD HH24:MI:SS') end_date
, to_date ('2013-12-05 04:30:20 ',' YYYY-MM-DD HH24:MI:SS')
+ ((to_date ('2013-12-06 15:00:30 ',' YYYY-MM-JJ HH24:MI:SS')-to_date ('2013-12-05 04:30:20 ',' YYYY-MM-DD HH24:MI:SS')) / 2) date_in_the_middle))
of the double
START_DATE END_DATE DATE_IN_THE_MIDDLE
------------------- ------------------- -------------------
2013-12-05 04:30:20-2013-12-06 15:00:30 2013-12-05 21:45:25
-
Start-up applications to receive messages from windows that have stopped working. One of them is IE3SH application has stopped working. How can I fix it?
Hi 9gonz9,
Welcome to the Microsoft Answers site!
You get this error message when you start the desktop computer?
You can check if the complete startup items are checked in the msconfig utility.
1. open System Configuration by clicking Start , clicking Control Panel, clicking system and security, clicking Administrative Tools, and then double-click the System Configuration.
If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.
2. click the Startup tab and check if all the items are archived there.
You can also run a bag of security for your computer and check if this solves the problem.
http://www.Microsoft.com/Security_Essentials/
If the problem persists, turn the computer in clean boot and check if all the background program is causing this error message. To help resolve the error and other messages, you can start Windows Vista by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.
The steps to perform a clean boot are given below:
1 log on to the computer using an account with administrator rights
2. click on start, type msconfig.exe in the start search box and press ENTER to start the System Configuration utility.
If you are prompted for an administrator password or for confirmation, type your password, or click on continue
3. on the general tab, click Selective startup, and then clear the check box load startup items. (The check box use the file Boot is not available.)
4. on the Services tab, click to select the skin all the Microsoft services check box, and then click Disable all
Note: Following this step lets services Microsoft continue to run. These services include networking, Plug-and-Play, record of events, error reporting, and other services. If you disable these services, you can permanently delete all restore points. Do not do this if you want to use with existing restore points system restore utility
Once you start the office see if you get the error message. If not then follow the divide and conquer method mentioned in the article below to know which program is causing the problem.
For more information about the clean boot, follow the below given link:
How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
http://support.Microsoft.com/kb/929135
When you are finished troubleshooting, follow these steps to reset the computer to start as usual:
1. click on start, type msconfig.exe in the start search box and press ENTER.
If you are prompted for an administrator password or for confirmation, type your password, or click on continue.
2. on the general tab, click the Normal startup option, and then click OK.
3. When you are prompted to restart the computer, click on restart
Hope this information is useful.
Amrita M
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
HI: I use 14 items, were to deal with a large number of RAW files... shut down last night, started once again today and the tool "clone stamp", I can't get the circular cursor in diameter I want, it only gives me the type of the cross... I changed anything myself... need the circle again!
brucet32720494 wrote:
HI: I use 14 items, were to deal with a large number of RAW files... shut down last night, started once again today and the tool "clone stamp", I can't get the circular cursor in diameter I want, it only gives me the type of the cross... I changed anything myself... need the circle again!
Make sure that the ALT key is not stuck
Go in Edition > Preferences > display and cursors. Other sliders: Standard is the default value.
To change the size of the cursor, use the support according to the letter P on your keyboard. ] increase [decrease.
-
get the time for each transaction
Hi Master,
Someone asked me a question.
I have a pl/sql block with multiple DML operations. How do you know how much time took each DML operation (not on a single table, tables different operations are underway in my pl/sql block)? Like this
Update statement
INSERT statement
Remove the statement
I replied like that... Use dbms_utility.get_time... If each statement how long it takes... We can easily find...! Once, he said... no I want to use predefined packages. DBA does not accept.
How can I fix this... Masters?
Please advise... !!!
Concerning
AR
DBA will no longer accept pkgs installation... !!
Create an account of RTO and defend his position to not use standard Oracle supplied packages, take the DBA.
Therefore, these packages should already be installed.
(Some essential element of the information seems to be missing).
Since no valid rationale was given for this crazy requirement (IMHO), the correct solution may possibly be: replace your DBA.
(I'd love to hear from experienced 'why' people, this requirement would be valid.)
MK
-
How can I get the name of each field
When in a form with fields to fill in Acrobat Pro ms, I can click form prepare, then more, then set field calculation order...
A dialog box appears stating "calculated fields.
How can I get a list of all THE fields to fill?
roricka
The complete list is available in the field list in the bottom right of the window in form view prepare.
-
Get the date of each month in the last year
Hi all
I need to find the last date of the month for the year.
Example:
I used to spend the date or such year 2012 or 01-01-2012(DD-MM-YYYY)
SQL query should return the last date of the month as
31/01/2012
28/02/2012
31/03/2012
30/04/2012
.
.
.
.
.
12/31/2012
For more top the requirement that I wrote the SQL code following
select rownum as row_count, case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Jan_month, case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Feb_month, case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as mar_month, case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as apr_month, case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as may_month, case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jun_month, case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jul_month, case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as aug_month, case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as sep_month, case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as oct_month, case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as nov_month, case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as dec_month from dual connect by level <= 12 order by rownum;
Result
Jan_Month Feb_Month Mar_Month Apr_Month may_month jun_month jul_month aug_month sep_month oct_month nov_month dec_month 1 31/01/2014 2 28/02/2014 3 31/03/2014 4 30/04/2014 5 31/05/2014 6 30/06/2014 7 31/07/2014 8 31/08/2014 9 30/09/2014 10 31/10/2014 11 30/11/2014 12 12/31/2012 Except the result:
am result except as single line such as
Jan_Month Feb_Month Mar_Month Apr_Month may_month jun_month jul_month aug_month sep_month oct_month nov_month dec_month 31/01/2012 28/02/2012 31/03/2012 30/04/2012 31/05/2012 30/06/2012 31/07/2012 31/08/2012 30/09/2012 10/31/2012 30/11/2012 12/31/2012 Kindly give me suggestion to archive more high result.
Thanks and greetings
Saami
I agree with Marcus Pivot is the way to go on this subject... But on the other hand you almost solved yourself... it was just a max function for your results:
---------
select max(case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Jan_month, max(case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Feb_month, max(case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as mar_month, max(case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as apr_month, max(case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as may_month, max(case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jun_month, max(case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jul_month, max(case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as aug_month, max(case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as sep_month, max(case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as oct_month, max(case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as nov_month, max(case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as dec_month from dual connect by level <= 12 order by rownum;
AND to avoid hard-coding, you can also modify your query in the form:
select max(case when rownum=1 then last_day(to_date(to_char(rownum),'MM')) end) as Jan_month, max(case when rownum=2 then last_day(to_date(to_char(rownum),'MM')) end) as Feb_month, max(case when rownum=3 then last_day(to_date(to_char(rownum),'MM')) end) as mar_month, max(case when rownum=4 then last_day(to_date(to_char(rownum),'MM')) end) as apr_month, max(case when rownum=5 then last_day(to_date(to_char(rownum),'MM')) end) as may_month, max(case when rownum=6 then last_day(to_date(to_char(rownum),'MM')) end) as jun_month, max(case when rownum=7 then last_day(to_date(to_char(rownum),'MM')) end) as jul_month, max(case when rownum=8 then last_day(to_date(to_char(rownum),'MM')) end) as aug_month, max(case when rownum=9 then last_day(to_date(to_char(rownum),'MM')) end) as sep_month, max(case when rownum=10 then last_day(to_date(to_char(rownum),'MM')) end) as oct_month, max(case when rownum=11 then last_day(to_date(to_char(rownum),'MM')) end) as nov_month, max(case when rownum=12 then last_day(to_date(to_char(rownum),'MM')) end) as dec_month from dual connect by level <= 12 order by rownum;
Easy way: (without login)
SELECT LAST_DAY (TO_DATE (ROWNUM, 'MM')) AS Jan_month, LAST_DAY (TO_DATE (ROWNUM + 1, 'MM')) AS Feb_month, LAST_DAY (TO_DATE (ROWNUM + 2, 'MM')) AS Mar_month, LAST_DAY (TO_DATE (ROWNUM + 3, 'MM')) AS Apr_month, LAST_DAY (TO_DATE (ROWNUM + 4, 'MM')) AS May_month, LAST_DAY (TO_DATE (ROWNUM + 5, 'MM')) AS Jun_month, LAST_DAY (TO_DATE (ROWNUM + 6, 'MM')) AS Jul_month, LAST_DAY (TO_DATE (ROWNUM + 7, 'MM')) AS Aug_month, LAST_DAY (TO_DATE (ROWNUM + 8, 'MM')) AS Sep_month, LAST_DAY (TO_DATE (ROWNUM + 9, 'MM')) AS Oct_month, LAST_DAY (TO_DATE (ROWNUM + 10, 'MM')) AS Nov_month, LAST_DAY (TO_DATE (ROWNUM + 11, 'MM')) AS Dec_month FROM DUAL
See you soon,.
Manik.
-
How to get the date - 7 days (week)
Hi all
I am beginner in Java and JSP
I'm JSP search form (VO) where I need to set a default value for the start_date - 7 days
OK I get this display today date but how to get that displays a date-7 days?
< %
DateFormat df = new SimpleDateFormat ("JJ. MM.yyyy");
Date date = new Date();
String default = 'StartDate =' + df.format (new Date());
% >
ID
Thank youSimple approach if you're not worried about leap years: -.
Date todayMinus7 = new Date(System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000);
Alternatively take a look at the GregorianCalendar class and the add() method.
Maybe you are looking for
-
I started to download Mozilla Sync to my computer, but stopped after reading an article in the terms of use. He States, "5. Your content in our Services: you can download content as part of the functionality of the Services. By downloading the conten
-
Hello I have a problem in my final application which is integrated under teststand. CVI currently plug-in, 2013. My MMI include buttons that are calling to reminders. In parallel, my app Contains 2 timers coming due all the 200ms and 100ms. In one of
-
HP 250 g3: impossible to format laptop
Hello, I need help please! Yesterday, I bought a hp 250 g3 without operating system and I'll have much trouble after format. I have windows 7 ultimate x 64 disc, but after much cleaned formats successfully I can't install hp drivers. I have downloade
-
My Windows XP is unable to send emails, as it did before. Help, please.
I'm online on Windows XP. I have my email address * address email is removed from the privacy *, where I always sent and received emails. I received my emails this time, but my computer does not send my email responses when I click 'send '. Help, p
-
I guess as the security update for Windows Vista (KB982799) do not install in the last time a few