use to insert the last day of each month
Hi, I wrote this code but it did not insert the 20 December and it is January 1, and next time running is 31 January... I would like to work to make this insert every last day of each month...begin
sys.dbms_job.submit(job => :job,
what => 'INSERT INTO hisrtu
SELECT rtunum, linked, dbchkd, chaqty, dbvald, ctrltr, meaadj, qtyrtu, month, year, entity, rtunam
FROM qtyrtu;',
next_date => to_date('31-10-2010 01:00:03', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'SYSDATE +30');
commit;
end;
/
I don't know if it's because I assigned the date 31-10... In November it's just but December has not...Best regards, hope you can help me.
I use oracle 9i
Hello
If you want the job to run at 02:00 the last day of the next month, then the desired argument is:
interval => 'ADD_MONTHS (TRUNC (SYSDATE, ''MONTH''), 2) - (22 / 24)'
In other words, if she finishes running at 02:30 on 31 January, then
TRUNC (SYSDATE, 'MONTH') will be at 00:00:00 January 1
ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1) will be March 1st at 00:00:00
ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), - 1) (22 / 24) will be 22 hours earlier, i.e. 02:00 on the last day of February.
logandro wrote:
I don't know if it's because I assigned the date 31-10... In November it's just but December has not...
Do you mean this line?
next_date-online to_date (October 31, 2010 01:00:03 ',' dd-mm-yyyy hh24:mi:ss'),
I don't think that's a problem. The next_date specifies only when it work baptisms. I guess he ran on October 31; you said it was running well on 30 November, 30 days after that. Something has to happen after November 30.
Note that the interval argument is relative when the task completes. If a task takes 30 minutes to run, then
interval => 'SYSDATE +30'
means that, if it turns to
01:00:03 October 31, then it will run again about
01:30:03 November 30, around
02:00:03 on December 30.
02:30:03 January 29 and so on. If your business does that for a few seconds, it won't matter much.
If you decide to use LAST_DAY, don't forget not that the hours-minutes-seconds referring LAST_DAY are the same as those of his argument.
Tags: Database
Similar Questions
-
First day/last day of each month
Hello
y at - it sql/script to get the first day/last day of each month.new to bi do not know the syntax
If a point on the link to get these things will be highly appreciatedHello
I suggest that you go through the following link(1) http://oracle.ittoolbox.com/groups/technical-functional/oracle-bi-l/obiee-date-comparison-1726677#M1729534
Toget first/last day of the month
(2) http://www.obinotes.com/2010/02/tip-to-get-firstday-lastday.html
New to OBIEE---> http://obiee101.blogspot.com/2009/07/obiee-how-to-get-started.html
Thank you
Saichand.V -
Select the last record of each month
Hello
to select the last docnumber and qty of every month
Structure
Name Null? Type
------------------------------- -------- ----
PRODUCTCODE NUMBER
NUMBER NUMBER
DATE OF PLANFORMONTH
NUMBER OF CLEXPECTEDQTY
NUMBER OF CLCONFIRMQTY
NUMBER OF CLFGBUFFERQTY
NUMBER OF CLTOTPRINTBUFFER
in this select query if I take the sum he required all records where, as I want the last record of each month
SELECT productcode docnumber MAX (Number), planformonth, SUM (clexpectedqty) clexpectedqty (planformonth) MAX.
SUM (clconfirmqty) clconfirmqty, SUM (clfgbufferqty) clfgbufferqty, cltotprintbuffer OF FGSALESPLAN of the SUM (cltotprintbuffer)
GROUP BY productcode, (planformonth)
Sandy
Hello
Thanks its working now the code is written as below:
SELECT * FROM
(SELECT
e.*,
ROW_NUMBER() OVER (partition by PRODUCTCODE by DOCNUMBER DESC order) r
Of
E FGSALESPLAN)
WHERE r = 1 AND
entryvalid = 'Y '.
order by Number
Sandy
-
for the 25th day of each month in Date function
Dear all,
I want to want to get the 25th day of each month
as.
Select sysdate from dua.
ConcerningSQL> select trunc(sysdate,'MM')+24 "Day" from dual; Day --------- 25-MAY-13
-
How to get the last day of a month for every 2 months for a given period?
Hello
Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?
Thanks in advance.
Try the below
SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.
SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1
WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
END as lastweekday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
-(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).
END as lastweekendday,
BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY
THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))
Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7
END AS lastmonday
FROM (SELECT SYSDATE startdate,
SYSDATE + 300 enddate
THE DOUBLE)
CONNECT BY LEVEL<=>=>
-
Hi can someone help me to achieve this scenario...
Thanks in advance...
Hello
Make the scenario for each interface and expand when the script option is planning.
Scheduling---> option execution---> select month (day of week)---> monthly date = last & Sunday and schedule accordingly.
Let me know
Thank you
-
Hi all
I want to clarify in the repeat_interval the Scheduler for this task must be run on the second of each month at 20:00.
I've been racking my brains out but nothings coming out.
Any suggestions?You probably want a range like this:
FREQ=MONTHLY;BYMONTHDAY=2;BYHOUR=20;BYMINUTE=0;BYSECOND=0;
You can use the DBMS_SCHEDULER. EVALUATE_CALENDAR_STRING function to test, as follows:
SQL > DECLARE 2 start_date TIMESTAMP; 3 return_date_after TIMESTAMP; 4 next_run_date TIMESTAMP; 5 BEGIN 6 start_date := 7 to_timestamp_tz('01-JAN-2003 10:00:00','DD-MON-YYYY HH24:MI:SS'); 8 return_date_after := start_date; 9 FOR i IN 1..5 LOOP 10 DBMS_SCHEDULER.EVALUATE_CALENDAR_STRING( 11 'FREQ=MONTHLY;BYMONTHDAY=2;BYHOUR=20;BYMINUTE=0;BYSECOND=0;', 12 start_date, return_date_after, next_run_date); 13 DBMS_OUTPUT.PUT_LINE('next_run_date: ' || next_run_date); 14 return_date_after := next_run_date; 15 END LOOP; 16 END; 17 / next_run_date: 01/02/2003 08:00:00.000000 PM next_run_date: 02/02/2003 08:00:00.000000 PM next_run_date: 03/02/2003 08:00:00.000000 PM next_run_date: 04/02/2003 08:00:00.000000 PM next_run_date: 05/02/2003 08:00:00.000000 PM
-
* Original title: screen flickers
These last days on each screen by clicking on sparkles and top rollers at the bottom makes it difficult to work. What could be the reason? Windows 7 Professional operating systems.
I have since uninstalled Adobe Flash as Java and I find twinkle and has stopped rolling top screen downstairs. In case the problem recurs, I'll follow the advice given by you. Thanks for your quick response.
-
Select the last value for each day of the table
Hello!
I have a table that contains several measures for each day. I need two queries on this table, and I'm not sure how to write them.
The table stores the rows (sample data)
Explanation of the data in the sample table:*DateCol1 Value Database* 27.09.2009 12:00:00 100 DB1 27.09.2009 20:00:00 150 DB1 27.09.2009 12:00:00 1000 DB2 27.09.2009 20:00:00 1100 DB2 28.09.2009 12:00:00 200 DB1 28.09.2009 20:00:00 220 DB1 28.09.2009 12:00:00 1500 DB2 28.09.2009 20:00:00 2000 DB2
We measure the size of the data files belonging to each database to one or more times a day. The value column indicates the size of the files of database for each database at some point (date in DateCol1 European model).
What I need:
Query 1:
The query must return to the last action for each day and the database. Like this:
Query 2:*DateCol1 Value Database* 27.09.2009 150 DB1 27.09.2009 1100 DB2 28.09.2009 220 DB1 28.09.2009 2000 DB2
The query should return the average measurement for each day and the database. Like this:
Could someone please help me to write these two queries?*DateCol1 Value Database* 27.09.2009 125 DB1 27.09.2009 1050 DB2 28.09.2009 210 DB1 28.09.2009 1750 DB2
Please let me know if you need further information.
Published by: user7066552 on September 29, 2009 10:17
Published by: user7066552 on September 29, 2009 10:17Why two queries when it suffice ;)
SQL> select dt 2 , db 3 , val 4 , avg_val 5 from ( 6 select dt 7 , val 8 , db 9 , row_number () over (partition by db, trunc (dt) 10 order by dt desc 11 ) rn 12 , avg (val) over (partition by db, trunc (dt)) avg_val 13 from test) 14 where rn = 1 15 order by dt 16 / DT DB VAL AVG_VAL --------- ----- ---------- ---------- 27-SEP-09 DB2 1100 1050 27-SEP-09 DB1 150 125 28-SEP-09 DB2 2000 1750 28-SEP-09 DB1 220 210
-
How to get the same day of a month each year in the DB (update a flag)
Hello
I'm trying to make a update for a table of flag request in our database that contains the dates and the Pavilion columns. Currently the system have dates for the next ten years. The flags are updated with the values 0 or 1, if a particular date falls under the criteria required.
I need to update the column flag for the same day of the month of each year. for example, 2nd Sunday of October. The value must be updated in all the years in the table. Currently I use the following query to update of the current year.
UPDATE FILTERCALENDAR SET YEAR_WINDOW = 1 WHERE c_date = NEXT_DAY (TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1) * 7;
and for the next year as
UPDATE FILTERCALENDAR SET YEAR_WINDOW = 1 WHERE c_date = add_months (NEXT_DAY (TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1) * 7, + 12)-1;
This isn't a great way to do it because he does not take care of leap years, and it does not scan and update values across the table for all the years correctly.
Can someone help me fix this please.Welcome to the forum!
Whenever you provide post your Oracle version 4-digit (result of SELECT * FROM V$ VERSION)
>
and for the next year asUPDATE FILTERCALENDAR SET YEAR_WINDOW = 1 WHERE c_date = add_months (NEXT_DAY (TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1) * 7, + 12)-1;
>
Why do you use "2013" in the TO_DATE for the year next rather than use simply '2014 '?You said it works
>
UPDATE FILTERCALENDAR SET YEAR_WINDOW = 1 WHERE c_date = NEXT_DAY (TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1) * 7;
>
Just interview the years from your table (list of the separate years) and use the query above on them.SELECT DISTINCT TO_CHAR(c_date, 'yyyy') FROM FILTERCALENDAR
Or use this predicate
WHERE c_date = next_day(last_day(add_months (c_date, -1)), 'SUNDAY') + 7 AND TO_CHAR(c_date, 'mm') = '10'
1 TO_CHAR ensures that the line has a month to October.
2 ADD_MONTHS goes to Sept. 1.
3 LAST_DAY going until the last day of September.
4 NEXT_DAY goes to the first Sunday in October
5 + 7 is going to the second Sunday in October -
ORA-01847: day of the month must be between 1 and the last day of the month
Hi all
Select
To_date(mDate||) e '|| mtime, "YYYY-MM-DD HH24MISS") meddate
of PR_MOCTEST_TEMP
mDate IS OF TYPE of DATA VARCHAR2 AND mtime OF VARCHAR2
mDate: 07-09-2009
mtime: 131241
mDate IS IN FORMAT DD-MONTH-YYYY
mtime: HHMMS
mtimeOF IS OF TYPE of DATA VARCHAR2 AND VARCHAR2 mDate
mDate: 07-09-2009
mTIME: 131241
mDATE IS IN FORMAT DD-MONTH-YYYY
mTIME: HHMMS
I NEED TO COMBINE THE 2 COLUMNS TO GET THE OUTPUT AS DD-MM-YYYY HH24MISS
AND I AM GETTING THE ERROR;
ORA-01847: day of the month must be between 1 and the last day of the month
where mistaken?
Please notify
KaiYou will find the bad dates using a table of logging of errors:
--we'll try to insert into here, invalid dates will be thrown out create table dst(d date); -- create an error log table dst_err exec dbms_errlog.create_error_log('dst', 'dst_err'); -- try the insert. Will fail with your ORA-01847 insert into dst select TO_DATE(mdate||' '||mtime,'DD-MM-YYYY HH24MISS') from PR_MOCTEST_TEMP log errors into dst_err('comment'); -- view the errors select * from dst_err;
-
Stop/Fix "Please insert the last disk of all selfextracting and click OK to continue.
(With the help of Win 7 32 - bit update)
I have not used a disk of 3.5 inches for many years. In addition, I have not used any device (USB, CD or DVD) that has / had problems of "whole selfextracting.
Also, AutoPlay was disabled on my system for years.
That said, whenever I do a search of file/folder I get "Please insert the last disk of all selfextracting and click OK to continue.
How can I be to determine:
- What causes the error message and/or
- How to stop it forever!
Thanks for any thoughts or ideas!
DennisCPA
Don't know if you've discovered this done yet for you, but I would say it is your usb flash drive. It happens when he is out BEFORE you used the 'Safely remove' icon on the taskbar.
If it is, then you must copy any information on the USB key to another location and format the USB. Then you can copy the info on it and you're right to go!
This will continue to happen sometimes even though you have the properties/policies defined in a quick deletion. I got mine the value of the radio button performance and ALWAYS use the icon REMOVE safe in your taskbar. Once you find that your data will be corrupted if is not removed properly, even if the ssd is supposed to be "hot." If you have a usb key that has a light on it, wait for the light to STOP BLINKING before removing it. If you do not have a light on this issue, it is always advisable to wait a second or two after the popup window say you that it is save to remove your USB.
See you soon
Glenn
-
Hello
How can I get the (day number of the) last day of a given month and year?
So, if
year 2015 = and month = 1, the output should be 31
year = 2012 and month = 2 while production is expected to be 29
year 2013 = and month = 2 while production is expected to be 28
etc.
Y at - it no OBIEE to achieve? If not, then a command SQL Oracle is very good too (I prefer OBIEE however)
Thanks in advance,
Erik
You start from the first day of the month, you add 1 month [TIMESTAMPADD (SQL_TSI_MONTH, 1, 'your date')], you must subtract 1 day [TIMESTAMPADD (SQL_TSI_DAY,-1, 'your date')] and use the DAYOFMONTH function to get the number of the last day of the month [DAYOFMONTH ('your ' date')].
All these calls nesting together and you're there.
-
How to get the last day of the weekend rather than a month
Hi all
Is the request appropriate and preferable to use to get the last business day of the month below?
SELECT to_date('13.08.2014','dd.mm.yyyy') + MAX(RNUM) LastDay(nonweekend) FROM (SELECT ROWNUM RNUM FROM ALL_OBJECTS where rownum <=31) WHERE ROWNUM <= 31 ANd TO_CHAR(to_date('13.08.2014','dd.mm.yyyy') + RNUM, 'DY','NLS_DATE_LANGUAGE=ENGLISH' ) NOT IN ('SAT' , 'SUN') and to_date('13.08.2014','dd.mm.yyyy') + RNUM <= last_day(to_date('13.08.2014','dd.mm.yyyy'))
I have to use this motion for production.
East - recommended to use?
You can change your query this way:
WITH t AS (SELECT trunc (to_date ('& calc_date', 'dd.mm.yyyy'), 'mm') + level - 1 calc_date)
OF THE DOUBLE
CONNECT BY LEVEL<= last_day(to_date('&calc_date',="" 'dd.mm.yyyy'))="" -="" trunc(to_date('&calc_date',="" 'dd.mm.yyyy'),="" 'mm')="" +="">=>
)
Select max (calc_date)
t
where to_char (calc_date, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') NOT IN ("SAT", "Sun");
-
How to get the last day of the week?
HII
I can get the week number of calendar for a given date using
SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual
can any body tell me, how to get the last day of the week?
and the answer should be: 04/08/2011(8th april)
Thank you
San
Published by: sandeep9 on April 4, 2011 03:50Perhaps this...
SQL> select trunc(sysdate,'WW')+6 from dual; TRUNC(SYSDATE,'WW')+ -------------------- 08-APR-2011 00:00:00 SQL>
Maybe you are looking for
-
I have some files .cda I want to change the mp3 files and burn to a cd. How can I do this?
-
Where Microsoft's products are installed on the laptop?
Hello. I bought my computer (laptop Gateway) from Best Buy. I have the download product key: microsoft work 8.5; Money 2006; Encarta and image digital starter for windows Vista. where is this software? Thank you very much. Tony
-
You are not allowed on this computer to install Kodak printer all in one
I have a kodal while a printer installed. When I try to print it will only allow me to print sizes THEY have. If click Custom to select the paper size, I really want to use it, says this feature is not available because you are not allowed to save
-
Is it possible to save an EX60 as a third-party SIP (Advanced) on the CUCM device?
Hello world I'm new to the word video, telepresence, H323, SIP. I know that it is now possible (and recommended) to save natively EX60/90 on the CUCM, IE as telepresence devices (whether with the TC firmware or TE) and support the full functionality
-
Students and teachers creative cloud to the Mexico
Why not open cloud platform creative students and teachers to the Mexico