End date of current quarter
Hi experts,My qry below works well with sysdate but when m by the way a date is to launch an error for the current quarter end date...
select add_months(trunc('20-dec-2012','q'),3) - 1 from dual
ERRORERROR on line 1:
ORA-00932: inconsistent data types: expected DATE got the NUMBER
even after adding the to_date function between trunc and date...
Kindly help
Thnx in advance...
We prove that it does not, even with the good to_date
Here is my proof it does:
SQL> select add_months(trunc(to_date('20-DEC-2012', 'DD-MON-YYYY'), 'q'), 3)-1 f
rom dual;
ADD_MONTH
---------
31-DEC-12
Version 11.2.0.3, Windows 64-bit
Tags: Database
Similar Questions
-
Is there currently an end date for CS6 support?
Is there currently an end date for CS6 support? Is there currently an end date for CS6 support?
A link to buy the CS6 via phone http://www.adobe.com/products/cs6.html read the part on the CS6 is more updated
-
How to complete the data for months current quarter of the last month of the previous quarter
- Here is the create table and insert the statement how my data is asCREATE TABLE SAMPLEDATA (Snapshot_M DATE, Date_Ky DATE, F_Quantities INTEGER)INSERT INTO VALUES SAMPLEDATA (SEPTEMBER 1, 2014 ", 1 SEPTEMBER 2014", 14)INSERT INTO VALUES SAMPLEDATA (OCTOBER 1, 2014 ", 1 OCTOBER 2014", 13)INSERT INTO VALUES SAMPLEDATA (1 NOVEMBER 2014", 1 NOVEMBER 2013', 12)INSERT INTO VALUES SAMPLEDATA (DECEMBER 1, 2014", 1 DECEMBER 2013', 11)INSERT INTO VALUES SAMPLEDATA (JANUARY 1, 2014 ", 1 JANUARY 2014", 10)INSERT INTO VALUES SAMPLEDATA (FEBRUARY 1, 2014 ", 1 FEBRUARY 2014", 90)INSERT INTO VALUES SAMPLEDATA (MARCH 1, 2014 ", 1 MARCH 2014", 20)INSERT INTO VALUES SAMPLEDATA (APRIL 1, 2014 ", 1 APRIL 2014", 23)INSERT INTO VALUES SAMPLEDATA (MAY 1, 2014", 1 MAY 2014', 30)INSERT INTO VALUES SAMPLEDATA (JUNE 1, 2014 ", 1 JUNE 2014", 70)INSERT INTO VALUES SAMPLEDATA (JULY 1, 2014 ", 1 JULY 2014", 20)Desired results set:Snapshot_M Date_Ky F_Quantities10 1/1/2014-2/1/201410 1/1/2014-3/1/201401/01/2014 41 10/20144/1/2014 5/1/2014 234/1/2014 6/1/2014 234/1/2014 7/1/2014 23My requirement is to load the data in the cube.So to summarize, data that are loaded onto the month last only a quarter Q1 tax (Jan) should server as a data for the quarter Q2 next month (February, March, April), the data loaded on the last month of Q2 (Apr) will be server as forecast data for Q3 months and so on.Thank you in advance.
with
SAMPLEDATA as
(select to_date('09/1/2014','mm/dd/yyyy') snapshot_m, to_date('09/01/2014','mm/dd/yyyy') date_ky, 14 f_quantities of all the double union)
Select to_date (October 1, 2014 "," mm/dd/yyyy ""), to_date (1 October 2014 "," mm/dd/yyyy"), 13 union double all the
Select to_date (November 1, 2013 "," mm/dd/yyyy ""), to_date (1 November 2013 "," mm/dd/yyyy"), 12 union double all the
Select to_date (December 1, 2013 "," mm/dd/yyyy ""), to_date (1 December 2013 "," mm/dd/yyyy"), 11 union double all the
Select to_date (January 1, 2014 "," mm/dd/yyyy ""), to_date (1 January 2014 "," mm/dd/yyyy"), 10 of all the double union
Select to_date (February 1, 2014 "," mm/dd/yyyy ""), to_date (1st February 2014 "," mm/dd/yyyy"), 90 union double all the
Select to_date (March 1, 2014 "," mm/dd/yyyy ""), to_date (1 March 2014 "," mm/dd/yyyy"), 20 union double all the
Select to_date (April 1, 2014 "," mm/dd/yyyy ""), to_date (1 April 2014 "," mm/dd/yyyy"), 23 union double all the
Select to_date (May 1, 2014 "," mm/dd/yyyy ""), to_date (1 may 2014 "," mm/dd/yyyy"), 30 union double all the
Select to_date (June 1, 2014 "," mm/dd/yyyy ""), to_date (1 June 2014 "," mm/dd/yyyy"), 70 union double all the
Select to_date (July 1, 2014 "," mm/dd/yyyy ""), to_date (1 July 2014 "," mm/dd/yyyy"), 20 union double all the
Select to_date (August 1, 2014 "," mm/dd/yyyy ""), to_date (1 August 2014 "," mm/dd/yyyy"), 22 of the double
)
Select snapshot_m, date_ky, last_value (f_quantities) ignore nulls on f_quantities (order by date_ky)
of (trunc (add_months (snapshot_m-1), 'q') select snapshot_m, date_ky,)
-case when trunc (add_months (snapshot_m-1), 'q')! = lag (trunc (add_months(snapshot_m,-1), 'q')) (date_ky order)
then lag (f_quantities) (date_ky order)
end f_quantities
of sampledata
where date_ky > = date ' 2014-01-01'
)
where snapshot_m > = date ' 2014-01-01'
order of date_ky
SNAPSHOT_M DATE_KY F_QUANTITIES 01/01/2014 01/02/2014 10 01/01/2014 01/03/2014 10 01/01/2014 01/04/2014 10 01/04/2014 01/05/2014 23 01/04/2014 01/06/2014 23 01/04/2014 01/07/2014 23 01/07/2014 01/08/2014 20 01/07/2014 01/09/2014 20 01/07/2014 01/10/2014 20 Concerning
Etbin
-
Hello people:
I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.
Any help or pointers would be great!
Thank you!
Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).
The request in hand:
SELECT first_thursday + (7 * (LEVEL - 1)) AS week_start_date, first_thursday + (7 * LEVEL) - 1 AS week_end_date FROM ( SELECT TRUNC(p_from_date + 4, 'IW') - 4 AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date TRUNC( p_to_date + 4, 'IW') - 5 AS last_wednesday FROM ( SELECT to_date('01-JAN-2013') AS p_from_date, NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date FROM dual ) parms ) end_points CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
Currently, this is the result I get (I'm only including the months of January and December here).
Week_Start_Date Week_End_Date 27-DEC-12 02-JAN-13 03-JAN-13 09-JAN-13 10-JAN-13 16-JAN-13 17-JAN-13 23-JAN-13 24-JAN-13 30-JAN-13 31-JAN-13 06-FEB-13
December:
28-NOV-13 04-DEC-13 05-DEC-13 11-DEC-13 12-DEC-13 18-DEC-13 19-DEC-13 25-DEC-13
What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:
January:
01-JAN-13 02-JAN-13 03-JAN-13 09-JAN-13 10-JAN-13 16-JAN-13 17-JAN-13 23-JAN-13 24-JAN-13 30-JAN-13 31-JAN-13 31-JAN-13
February:
01-FEB-13 06-FEB-13 07-FEB-13 13-FEB-13 14-FEB-13 20-FEB-13 21-FEB-13 27-FEB-13 28-FEB-13 28-FEB-13
November:
31-OCT-13 06-NOV-13 07-NOV-13 13-NOV-13 14-NOV-13 20-NOV-13 21-NOV-13 27-NOV-13 28-NOV-13 04-DEC-13
December:
01-DEC-13 04-DEC-13 05-DEC-13 11-DEC-13 12-DEC-13 18-DEC-13 19-DEC-13 25-DEC-13 26-DEC-13 31-DEC-13
Hello
Roxyrollers wrote:
Hello people:
I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.
Any help or pointers would be great!
Thank you!
Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).
The request in hand:
- First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
- first_thursday + (7 * LEVEL)-1 AS week_end_date
- Of
- (
- SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
- TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
- Of
- (
- SELECT to_date('01-JAN-2013') AS p_from_date,
- NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
- OF the double
- ) parms
- ) end_points
- CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">=>
Currently, this is the result I get (I'm only including the months of January and December here).
- Week_Start_Date Week_End_Date
- DECEMBER 27, 12 2 JANUARY 13
- JANUARY 3, 13 JANUARY 9, 13
- 10 JANUARY 13 JANUARY 16, 13
- 17 JANUARY 13 23 JANUARY 13
- 24 JANUARY 13 30 JANUARY 13
- 31 JANUARY 13 FEBRUARY 6, 13
December:
- NOVEMBER 28, 13 4 DECEMBER 13
- 5 DECEMBER 13 DECEMBER 11, 13
- 12 DECEMBER 13 18 DECEMBER 13
- 19 DECEMBER 13 DECEMBER 25, 13
What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:
January:
- JANUARY 1, 13 2 JANUARY 13
- JANUARY 3, 13 JANUARY 9, 13
- 10 JANUARY 13 JANUARY 16, 13
- 17 JANUARY 13 23 JANUARY 13
- 24 JANUARY 13 30 JANUARY 13
- 31 JANUARY 13 JANUARY 31, 13
February:
- 1ST FEBRUARY 13 FEBRUARY 6, 13
- 7 FEBRUARY 13 FEBRUARY 13, 13
- 14 FEBRUARY 13 FEBRUARY 20, 13
- 21 FEBRUARY 13 FEBRUARY 27, 13
- 28 FEBRUARY 13 FEBRUARY 28, 13
November:
- 31 OCTOBER 13 NOVEMBER 6, 13
- 7 NOVEMBER 13 NOVEMBER 13, 13
- 14 NOVEMBER 13 NOVEMBER 20, 13
- 21 NOVEMBER 13 NOVEMBER 27, 13
- NOVEMBER 28, 13 4 DECEMBER 13
December:
- 1ST DECEMBER 13 DECEMBER 4, 13
- 5 DECEMBER 13 DECEMBER 11, 13
- 12 DECEMBER 13 18 DECEMBER 13
- 19 DECEMBER 13 DECEMBER 25, 13
- 26 DECEMBER 13 DECEMBER 31, 13
Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less? (For example, February 28 is a 'week' alone.)
The following works for the other months:
WITH all_days AS
(
SELECT DATE "2013-01-01' + LEVEL - AS a_date 1
OF the double
CONNECT BY LEVEL<=>=>
)
SELECT DISTINCT
More GRAND (TRUNC (a_date + 4, 'IW') - 4)
, TRUNC (a_date, 'MONTH')
) AS week_begin
, The LEAST (TRUNC (a_date + 4, 'IW') + 2
TRUNC (LAST_DAY (a_date))
), Week_end
Of all_days
ORDER BY week_begin
;
Output:
WEEK_BEGIN WEEK_END
----------- -----------
January 1, 2013 January 2, 2013
January 3, 2013 January 9, 2013
January 10, 2013 January 16, 2013
January 17, 2013 January 23, 2013
January 24, 2013 January 30, 2013
January 31, 2013 January 31, 2013
February 1, 2013 February 6, 2013
February 7, 2013 February 13, 2013
February 14, 2013 February 20, 2013
February 21, 2013 February 27, 2013
February 28, 2013 February 28, 2013
...
November 1, 2013 November 6, 2013
November 7, 2013 November 13, 2013
November 14, 2013 November 20, 2013
November 21, 2013 November 27, 2013
November 28, 2013 November 30, 2013
December 1, 2013 December 4, 2013
December 5, 2013 December 11, 2013
December 12, 2013 December 18, 2013
December 19, 2013 December 25, 2013
26 December 2013 31 December 2013
-
You will need to add the number of days to the end date of the users.
Hello
I have a code where we adding the number of days (30) to the current date and update IDM DB user end date.
Now, we have a requirement to add the number of days (30) to the existing fence of user instead of add to the current date.
* public String incrementDate (int daysToAdd)
{
Start date
log.info("NotifyLastDayOfService::incrementDate(): entrez»);
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-DD 00:00:00");
Calendar c = Calendar.GetInstance ();
c.Add (Calendar.DATE, daysToAdd); number of days to add
String PROMOTIONDate = sdf.format (c.getTime ());
log.info("NotifyLastDayOfService::incrementDate(): sortie»);
return Nouvelle_date;
}*/
Have any body set up this scenario?
Please suggest.
Thank you
Kalpana.You can try this as well
where oimAttribute = "Users.End Date"
public String updateOIMAttributeForDateType (String oimAttribute, Date endDate, long take, String daysToAdd)
{
tcUserOperationsIntf userOperationsIntf = null;
HashMapmodifyMap = new HashMap () ;
HashMapsearchmap = new HashMap () ;
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-DD hh: mm :"); ")
try {}
Calander cal = null;
cal.setTime (endDate);
Cal.Add (Calendar.DATE, Integer.parseInt (daysToAdd));
Date Edate = cal.getTime ();modifyMap.put (oimAttribute, Edate);
searchmap.put ("Users.Key", String.valueOf (take));
userOperationsIntf = Platform.getService (tcUserOperationsIntf.class);
tcResultSet searchset = (searchmap) userOperationsIntf.findAllUsers;
userOperationsIntf.updateUser (searchset, modifyMap);
return a SUCCESS;
} catch (Exception e) {}
If (Logger.isErrorEnabled ()) logger.error (e.getMessage ());
error return;
} {Finally
try {}
If (userOperationsIntf! = null) userOperationsIntf.close ();
} catch (Exception e) {if (logger.isErrorEnabled ()) logger.error (e.getMessage ()) ;}}
} -
update of the end date on the dates that overlap
Hello
I have this situation
Status start_date end_date
OP 1 January 2007 31 - dec - 2099
W1 01-apr-2007 30-sep-2008
October 1, 2008 31 - dec - 2099 W2
W3 1 January 2009 31 - dec - 2010
January 1, 2011 31 - dec - 2099 W4
the December 31, 2099 end_date "is a conventional date and indicating the valid (current) state that should be the last"
I want to update the value of the end date to the same value as the date of the next valid record
result
Status start_date end_date
OP 1 January 2007 31 - mar - 2007
W1 01-apr-2007 30-sep-2008
October 1, 2008 31 - dec - 2008 W2
W3 1 January 2009 31 - dec - 2010
January 1, 2011 31 - dec - 2099 W4
Any help?
Thanks in advance
lukxHello
Here's a way to do it:
MERGE INTO table_x dst USING ( SELECT start_date -- or primary key , LEAD (start_date) OVER (ORDER BY start_date) - 1 AS end_date FROM table_x ) src ON (src.start_date = dst.start_date) -- or primary key WHEN MATCHED THEN UPDATE SET dst.end_date = src.end_date WHERE src.end_date IS NOT NULL AND end_date = DATE '2099-12-31' -- if wanted ;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
-
IOM disables the user on the end date
Hello
We have inherited the IOM system therefore needs to check the default IOM. When we enter the current date as the end date, IOM automatically disables the user. This custom behavior or it's the default?
I ask this question because the new requirement is that the user must be turned off at 18:00 the end day immediately after the reconciliations.
Thanks in advanceIt is on the behavior of the box.
Thank you
Suren -
Continuous start date and end date
Hello
I'm currently building a SQL query to get the min (start date) and max (end date) of the below dataset. The trick here is to consider the date min and max, if it is continuous otherwise are indicated separately. 1 January 01 is also the date of default null value in the system which is equivalent to 31-dec-2999.
Set of input data
MPRid METid START_DATE end_date
---------------------- ---------------------- ------------------------- -------------------------
13940003 128127878 18 March 2008 March 19, 2008
13940003 128127878 19 March 2008 March 27, 2008
13940003 128127878 27 March 2008 1 January 01
13940003 50368431 October 1, 1995 December 29, 1995
13940003 50368431 29 December 1995 March 21, 1996
13940003 50368431 March 21, 1996 February 22, 1997
13940003 50368431 22 February 1997 December 18, 2001
13940003 50368431 18 December 2001 March 11, 2008
13940003 50368431 14 March 2008 March 15, 2008
Expected results
MPRid METid START_DATE end_date
---------------------- ---------------------- ------------------------- -------------------------
13940003 128127878 18 March 2008 1 January 01
13940003 50368431 1 October 1995 March 11, 2008
13940003 50368431 14 March 2008 March 15, 2008
I tried with partition but not getting is not the expected results. Looks like something wrong in the query. All suggestions will be of great help to me.
Select mprid, metid
min (start_date) start_date
max (end_date) end_date
from (select mprid, metid
start_date
decode(end_date,'01-Jan-0001','31-Dec-2999',end_date) end_date
max (grp) on maxgrp (partition mprid, metid start_date order)
from (select mprid, metid
start_date
End_date
case lag (end_date) over (partition mprid, metid start_date order)
When start_date then null
rownum else
end grp
of table_mpc
where mprid in (13940003) and metid is not null
)
)
Mprid group, metid
maxgrp
order of mprid, start_date
Thanks for looking in this query.
Concerning
DeborahHere's one way:
with my_tab as (select 13940003 mprid, 128127878 metid, to_date('18-Mar-2008', 'dd-Mon-yyyy') start_date, to_date('19-Mar-2008', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 128127878 metid, to_date('19-Mar-2008', 'dd-Mon-yyyy') start_date, to_date('27-Mar-2008 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 128127878 metid, to_date('27-Mar-2008', 'dd-Mon-yyyy') start_date, to_date('01-Jan-0001 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('01-Oct-1995', 'dd-Mon-yyyy') start_date, to_date('29-Dec-1995 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('29-Dec-1995', 'dd-Mon-yyyy') start_date, to_date('21-Mar-1996 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('21-Mar-1996', 'dd-Mon-yyyy') start_date, to_date('22-Feb-1997 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('22-Feb-1997', 'dd-Mon-yyyy') start_date, to_date('18-Dec-2001 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('18-Dec-2001', 'dd-Mon-yyyy') start_date, to_date('11-Mar-2008 ', 'dd-Mon-yyyy') end_date from dual union all select 13940003 mprid, 50368431 metid, to_date('14-Mar-2008', 'dd-Mon-yyyy') start_date, to_date('15-Mar-2008 ', 'dd-Mon-yyyy') end_date from dual), -- end of mimicking your data into a table called "my_tab" results as (select mprid, metid, start_date, decode(end_date, to_date('01/01/0001', 'dd/mm/yyyy'), to_date('31/12/2999', 'dd/mm/yyyy'), end_date) end_date, case when start_date != lag(end_date) over (partition by mprid, metid order by start_date, end_date) or row_number() over (partition by mprid, metid order by start_date, end_date) = 1 then row_number() over (partition by mprid, metid order by start_date, end_date) end grp from my_tab), final_res as (select mprid, metid, start_date, end_date, last_value(grp ignore nulls) over (partition by mprid, metid order by start_date, end_date) grp from results) select mprid, metid, min(start_date) start_date, decode(max(end_date), to_date('31/12/2999', 'dd/mm/yyyy'), to_date('01/01/0001', 'dd/mm/yyyy'), max(end_date)) end_date from final_res group by mprid, metid, grp order by mprid, metid, start_date; MPRID METID START_DATE END_DATE ---------- ---------- ---------- ---------- 13940003 50368431 01/10/1995 11/03/2008 13940003 50368431 14/03/2008 15/03/2008 13940003 128127878 18/03/2008 01/01/0001
Published by: Boneist on December 11, 2009 11:44
(corrected for 1 St-Jan-0001 I missed!) -
JDev 10.1.3: ADF - how a record end date
I'm relatively new to the ADF, but I have a question about a current record end. I have a table with a start and end on a record date. I created a method that allows the user to copy a record. I have a table read-only ADF, they choose the folder and click the copy button. It then displays an ADF form that allows the user to clone that record and make changes to it. The user can enter a start date for this record. Could someone point me in the right direction or provide certain documents how then can go back and end date the initially selected record with the date of departure just entered by the user? I thought that maybe I could override the doDML method in the object of the entity, but I'm not sure how to find the original record that the user has selected?Congratulations on getting the bits together, we will then look at your code.
0) you are referring to the 29 attribute. This will get you in trouble if the attr index never gets re-arranged. Instead you could probably do something like:
Line Fees001RowImpl = (Fees001RowImpl) getCurrentRow ();
.. then you can refer to the line attribute accessor:
row.getX () (where X is your name of the attribute... This assumes that you have created the class RowImpl for the VO).
(with apologies, I had to guess at some of your names in classes here, so you need to tweek the names of classes to match your exact code)
(1) why in endDateRecr() you call createRootApplicationModule()? This will create a separate transaction with the db and is probably the reason why you do not see your folder to refresh. If the client interface method is in your ViewObjectImpl, you should be able to simply call getApplicationModule(). Something like the following:
AppModuleImpl am = (AppModuleImpl) getApplicationModule ();
This should also give you the advantage you can now consult the Fees001ViewObject directly as follows:
Fees001ViewObject vo = am.getFees001View1 ();
.. ... who will isolate you from changing the name of the view object, you have hard-coded in the findViewObject call.
(2) you are browsing the VO Fees001. Instead, you can use vo.getKey () to find your exact line (assuming that you have the PK).
(3) you set the attribute to cost 2 + 3; similar to above, you could throw the charge line to an instance of Fee001RowImpl and then call the real setter methods provided for each attribute, isolate you from any changes to the index of the order of the attributes.
(4) any reason that you are explicitly committed within the model layer method? This is similar to the argument that you should never commit within a pl/sql package database because it is not obvious to the appellant from the outside that this happens. Rather let the commit to your Interface ActionListener.
I hope this helps. As I said it's a little difficult to give you the exact code I don't know the names of your object etc, but I hope it will be to steer you in the right direction.
CM.
-
Hello
I was told to come with the start and end date for the last quarter and I came up with this code. This could be written in a different way?
CREATE OR REPLACE PROCEDURE last_quarter_dates(p_start_date OUT DATE, p_end_date OUT DATE) IS BEGIN SELECT CASE to_char(SYSDATE, 'Q') WHEN '1' THEN to_date('Oct-1-' || to_char(to_number(to_char(SYSDATE, 'YYYY')) - 1), 'Mon-DD-YYYY') WHEN '2' THEN to_date('Jan-1-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') WHEN '3' THEN to_date('Apr-1-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') WHEN '4' THEN to_date('Jul-1-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') END start_date, CASE to_char(SYSDATE, 'Q') WHEN '1' THEN to_date('Dec-31-' || to_char(to_number(to_char(SYSDATE, 'YYYY')) - 1), 'Mon-DD-YYYY') WHEN '2' THEN to_date('Mar-31-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') WHEN '3' THEN to_date('Jun-30-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') WHEN '4' THEN to_date('Sep-30-' || to_char(SYSDATE, 'YYYY'), 'Mon-DD-YYYY') END end_date INTO p_start_date, p_end_date FROM dual; END last_quarter_dates;
Hello
The TRUNC function that makes it much easier:
SELECT TRUNC (ADD_MONTHS (SYSDATE, -3), 'Q') , TRUNC (SYSDATE, 'Q') - 1 INTO p_start_date , p_end_date FROM dual;
TRUNC (dt, 'Q') is the beginning of the quarter that contains dt.
ADD_MONTHS (dt,-3) is the 3 months before dt date, which will be always in the neighborhood before dt itself.Published by: Frank Kulash, March 30, 2009 12:44
As Boneist said, it's so simple that you do not want a procedure for this.
Whenever you write a procedure, make it general enough to handle the problems that may arise in the future.
For example, right now you have to find the relaticve p_start_date and p_end_date at the time of the day.
Don't you think that the same problem can happen, compared to some arbitrary on a given date?
You can write the proceudre so that it handles both cases. Do the default date today, but allow the appellant to provide any given date if necessary.CREATE OR REPLACE PROCEDURE last_quarter_dates ( p_start_date OUT DATE -- Beginning of quarter , p_end_date OUT DATE -- End of quarter (e.g., 31-Dec-2008 00:00:00 (not 23:59:59) , p_base_date IN DATE DEFAULT SYSDATE ) IS -- last_quarter_dates sets p_start_date and p_end_date to midnight of -- the first and last days in the quarter BEFORE p_base date -- (not the quarter containing p_base_date). -- For example, if this is run anytime in the first quarter of 2009, -- and p_base_date is not given, then -- p_start_date will be sert to 01-Oct-2008 00:00:00, and -- p_end_date 31-Dec-2008 00:00:00 BEGIN SELECT TRUNC ( ADD_MONTHS (p_base_date, -3), 'Q') , TRUNC ( p_base_date, 'Q') - 1 INTO p_start_date , p_end_date FROM dual; END last_quarter_dates;
-
I am suddenly unable to burn playlists to CD on my MacBook Air. I burned a CD only 2 days ago.
Error message says "Disc burner or software not found" iTunes software is up to date: the current version is 12.4.1
Hi BVBigelow,
I understand that you are not able to burn playlists in iTunes on your MacBook Air. Fortunately, we have an article (link below) which details a number of steps that can help to restore your ability to burn CDs of troubleshooting.
12 iTunes for Mac: If you have trouble burning a disc
Take care!
-
74-75 cartridges printers warranty end date
I just bought a pack of combo printer 74-75, and the warranty ends"date .dec 2015
should I return it to the store?
I would, if the package has not been opened. While the cartridges will probably still be OK they would not any guarantee of HP, so if he had any questions that they would be not covered.
-
Media player guide ID: 5 end date
My guide has an end date of 01/01/2013 11:00. Can I get a new free version?
Hello Neil Milliere,.
Please see the thread below because there was a problem with the program guide in the United Kingdom and Ireland. It must be corrected. If not, let us know.
http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-Winapps/the-electronic-program-guide-EPG-for-Windows-Media/923cf081-0607-497d-889c-6424e8299213Check also that all your Windows updates are up-to-date.
Thank you
Marilyn
-
Warranty end date Dell monitor
Hello
I work for a company who directs Dell products in bulk (several hundreds). Asked me to know the dates of end of warranty for all monitors. I have no way to make at the present time, because the monitors have no service tags, serial numbers only.
How can I get to determine the guarantee for all monitors end dates of these?
Thank you!
There is no easy way to do it. Each monitor has a 20-digit serial number and at least 3 years warranty.
Example = CZ0-F525M-73608-021-341 L
The 021 is the date code.
0 = 2010
2 = February
1 = 1If the three-year warranty ended February 1, 2013.
You need to save all and determine the date.
-
Alternate greeting - start and end date
We have 8.6 connection of the unit. I know alternate greetings may have end dates, but our users also want the start dates. Is this possible? I have not seen it mentioned anywhere, but I thought I would check before giving up on this subject.
Unfortunately not.
Chris
Maybe you are looking for
-
Satellite L300D-12Y - vertical stripes with 3D acceleration
Hello I bought a L300D-12Y some days and I do not like Vista, I installed Windows XP (SP2 Pro) on this subject. Then, I installed the drivers from the driver (display - 20090127162159.zip) page and began to play games to check the performance of the
-
Satellite P100 - 10 p: poor video quality with 3rd site nVidia Driver
I have a satellite P100 - 10 p (PSPAGE) with 7900 GS and when I install the new drivers from laptopvideo2go.com video quality (163.76) of all films is bad. The image is rasterized with each media player (VLC, MPC...) and screen sometimes "POPs" for a
-
How to separate the songs on 'album' in my Media Player?
Recently I had to restore my computer to factory settings. I did back up disks for all my personal files, including my Limewire p2p files. When I ripped the songs in p2p file media player, they all now show as AN unknown album. I have entered the
-
I need to print a new Page of alignment with each new cartridge?
I have to print a new alignment Page with each new cartridge I install on my HP Photosmart C4480? Or can I save and reuse the original I got when first installing my printer cartridges? The pages of the alignment, all seem to be the same when I pri
-
Application crashes after links compilations on the command line and running on Simulator
Hi all I have a project where I need to link my static libraries built separately (but using the toolchain/compiler inside the BBNDK) for a sample application QML BB10. I am relatively new to BB10 and its environment. Although the application compil