MrHelpMe,
Your code in your WHERE clause is
far more complicated than it needs to be. Presently your WHERE code, in order of execution, says:
1) Convert "arrival_time" from "epoch" (Universal Time Co-ordinated [UTC]) into a standard Oracle Date/Time in Mountain Daylight Timezone. (This part is fine)
2) Isolate the number of the current date's Day-of-the Week ["...to_char(sysdate,'D')..."]. For today (Sunday) that means Isolate "1", since Sunday is day number "1" of the week, then subtract 7 and add 1: "1-7+1 = -5"
3) Subtract that result (in this case, subtract -5, which effectively
adds 5 days to today) from the current date, and translate the resulting date (28-APR-06) into a character string that (as of this moment) looks like this: "28-APR-2006 10:58:18". (Notice that the result does not show that the time is A.M. or P.M.)
4) Again, isolate into a character string, the current date's Day-of-the-Week number ("1" = Sunday on my machine). Translate the charater "1" into a number and subtract 1 from the current date (yielding "22-APR-2006 10:58:18").
5) Lastly, display all rows that are ">= (the character string) '28-APR-2006 10:35:18' " and "<= (the character string) '22-APR-2006 10:37:50' ". Can you suggest
any character value that could result in a
TRUE condition? I can't...What string value can be ">= 28..." while at the same time is "<= 22..."
I would be willing to bet a month's income that
this WHERE clause is NOT what you intend. Keep in mind that in Oracle,
you need not/should not convert DATE/TIME expressions into character strings to do DATE comparisons. If you can put into simple, non-technical terms what DATE values you want your "arrival_time" to be "...BETWEEN...", then we can suggest a highly simplified WHERE clause to do what you want.
The fact that this WHERE clause doesn't do what you really want (i.e., logic error) does not explain why you are receiving the run-time error, "ORA-01830: date format picture ends before converting entire input string". This usually means that your data do not match your DATE-format mask.
To help troubleshoot this situation, could you please post what I asked for in my "22 Apr 06 12:43" post (but haven't seen yet)...I need you to post the results (from the SQL*Plus prompt) of this command: "describe hpd_helpdesk".
I also need to see some
actual data in your "hpd_helpdesk" tables, so could you please post the results of this query:
Code:
SELECT case_id_, arrival_time
from hpd_helpdesk
where rownum <= 5;
So, please post the items that I request, above.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[
Providing low-cost remote Database Admin services]
Click here to join
Utah Oracle Users Group on Tek-Tips if you use
Oracle in
Utah USA.