FutureDBA-
asked on
help with next_day
select NEXT_DAY(to_char(to_date(20131003,'yyyymmdd'), 'MON-DD-YY'),'Tuesday') from dual;
isnt working for me. i thought this is how it's supposed to be used. but i'm getting ORA-01858 a non-numeric character was found where a numeric was expected
Try
and read
http://docs.oracle.com/cd/ B19306_01/ server.102 /b14200/fu nctions093 .htm
select NEXT_DAY(to_date('20131003','yyyymmdd'),'Tuesday') from dual;
and read
http://docs.oracle.com/cd/
Do you want the next 'Tuesday' from the date you are entering? You're entering 20131003, the next Tuesday would be 20131008, is that what you want?
This will get you the next Tuesday in YYYYMMDD format from the given date:
This will get you the next Tuesday from today (sysdate):
This will get you the next Tuesday in YYYYMMDD format from the given date:
select to_char(next_day(to_date('20131003','YYYYMMDD'),'Tuesday'),'YYYYMMDD') NEXT_TUESDAY from dual;
This will get you the next Tuesday from today (sysdate):
select to_char(next_day(sysdate,'Tuesday'),'YYYYMMDD') NEXT_TUESDAY from dual;
ASKER
I am trying to use this within a case statement, when i use it standalone from dual it's fine, but when i u do
I get
CASE WHEN substr(RVCCUSWK1,1,1) = 1 THEN to_char(next_day(sysdate,'Sunday'),'YYYYMMDD') ELSE 0 END AS SUN,
I get
ORA-00932: inconsistent datatypes: expected CHAR got NUMBER
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
Error at Line: 15 Column: 97
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window