date-arithmetic

oracle 10g submit job function error

hi all, I'm trying to schedule a job in oracle 10g but it says: ORA-01846: not a valid day of the week. Heres my code: declare v_job_id1 number(19,0); v_job_id2 number(19,0); begin dbms_job.submit(v_job_id1, 'CTX_DDL.OPTIMIZE_INDEX(''PSO_KEYWORD_SEARCH_IDX'', ''FULL'', 45);', NEXT_DAY(TRUNC(SYSDATE), 4) + 13/24, NEXT_DAY...

Regarding date in sql

Here's my query: select * from test n WHERE lower(process_name) like 'test%' AND ( test_id is NULL OR TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE),-6),'YYYYMM') > TO_CHAR(n.process_date,'YYYYMM') I want check whether date field process_date is greater than 6 months in the query. ...

ORACLE SQL Date range intersections

I have a table T1, it contains a NAME value (not unique), and a date range (D1 and D2 which are dates) When NAME are the same, we make a union of the date ranges (e.g. B). But as a result (X), we need to make intersection of all the date ranges Edit: Table T1 NAME | D1 | D2 A | 20100101 | 20101211 B | 20100120 | 20100415 ...

Comparing dates in Oracle using the decode function

I need to compare two dates using the Oracle decode function to see if one is <= then the other. I found this article - http://www.techonthenet.com/oracle/functions/decode.php Which states (at the bottom) that the below decode function will return date2 if date1 > date2 : decode((date1 - date2) - abs(date1 - date2), 0, date2, date1) ...

SQL script for incrementing dates

Hi, I am not sure how to make an automaticed script that incrments all dates in a database. I was asked if the date is Friday, the script needs to increment the next business date to Monday, so I will need some logic in the script. This can be easily done in C# or any other programming language. But, I was required that the script must ...

how can I add 100 years to a date in Advantage Database

I have a bunch of records in my Advantage Database that ended up with the year 1909, rather than 2009. How can run an update statement that will add 100 years to each of these dates? (Advantage is telling me that there is no "str()" function, and it won't let me concatenate month(mydate) with "/". ...

Oracle SQL Where clause to find date records older than 30 days

I want to find records in a (Oracle SQL) table using the creation date field where records are older than 30 days. It would be nice to find records using a operators like > but if anyone can suggest quick SQL where clause statement to find records older than 30 days that would be nice. Please suggest Oracle syntax as that is what I am us...

What is the recommended way of doing date arithmetics in Perl?

What is the recommended way of doing date arithmetics in Perl? Say for example that I want to know the date three days ago from today (where today = 2010-10-17 and today - 3 days = 2010-10-13). How would you do that in Perl? ...