I don’t know much about BO scripts, but I have a guess. I assume you are using Oracle.
Your query says: " select begin_date from prod_dates where current_date_val = getdate() and region = ‘CE’ ". If you are using an Oracle database, the “getdate()” function just returns SYSDATE, right? So your query is really: " select begin_date from prod_dates where current_date_val = SYSDATE and region = ‘CE’ ".
The problem is, Oracle’s SYSDATE is not only the current date, but the current TIME, too. If I were to query my database right now, SELECT SYSDATE FROM DUAL would display the value “16-JUL-98”. But that’s misleading. It’s really returning the value “July 16, 1998, 3:46:29 PM”. The time portion does not get displayed, though, because my default date display format is ‘dd-MON-yy’. (How do you change the default date display format? I leave that as an exercise for the student.)
Now, suppose you inserted a record into PROD_DATES where CURRENT_DATE_VAL was ‘16-JUL-98’. Because you did not specify a time, this value is really “July 16, 1998, 12:00:00 AM”. This value does not equal the SYSDATE “July 16, 1998, 3:46:29 PM”, so your SELECT does not retrieve any rows!
Could this be the problem with your script?
Try changing your query to say this:
select begin_date from prod_dates where current_date_val = TRUNC( SYSDATE ) and region = ‘CE’
The TRUNC() function will strip off the time portion of SYSDATE; TRUNC( SYSDATE ) will return the value “July 16, 1998, 12:00:00 AM”.
Erich Hurst
IQDC Systems Analyst
Compaq Computer Corporation
I am trying to resolve my problem of looking for the current production dates using scripting. I have the following script, but it is not working…any ideas?
Listserv Archives (BOB member since 2002-06-25)