By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,334 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,334 IT Pros & Developers. It's quick & easy.

Federated (information integrator) load from cursor - Oracle date problem

P: n/a
Hi All;
We have many production jobs that "load from cursor" to a UDB/AIX 8.2
(with dpf) data warehouse from source tables residing Oracle 9i. Since
Oracle dates are (roughly) equivalent to DB2 timestamps, we frequently
use the date() function to "convert" from the Oracle date datatype to
the DB2 date datatype.

We have used this technique on over 20 Oracle tables for several months
with no problem. One table in particular fails with a sqlcode -180
(invalid db2 date value). Does anyone why we might be seeing this?.
Could it be that Oracle supports dates outside the range of that which
is supported by db2? Any help appreciated. Job output below...

Pete H
-------------------------------------------------
declare fedcurs cursor for
Select item
, loc
, constrstocklowqty
, date(constrstocklowdate)
, constrstocklowdur
, constrstocklowqty
, date(constrstockoutdate)
, constrstockoutdur
, maxconstrcovdur
, date(maxconstrcovdate)
from fdr.manu_skustatstatic
where item not like 'ITC%'
and item not like 'RM%'
and item not like 'PGM%'
and item not like 'IGP%'
and item not like 'ITM%'
;
SQLCODE is: 0

sqlcaid : SQLCA sqlcabc: 136 sqlcode: 0 sqlerrml: 0
sqlerrmc:
sqlerrp : SQL08023
sqlerrd : (1) 0 (2) 0 (3) 511397
(4) 180107 (5) 0 (6) 1
sqlwarn : (1) (2) (3) (4) (5) (6)
(7) (8) (9) (10) (11)
sqlstate: 00000
SQL stmt is:
load from fedcurs of cursor warningcount 2
messages /xxxx/prod/syslog/irw147.2006-06-05-02:55:08/irw147.loadmsgs
replace into STAGE.manu_skustatstatic
data buffer 600
redirect_part_output
/xxxx/prod/syslog/irw147.2006-06-05-02:55:08/load.log
;
SQLCODE is: -180

sqlcaid : SQLCA sqlcabc: 136 sqlcode: -180 sqlerrml: 0
sqlerrmc:
sqlerrp : SQLSNERR
sqlerrd : (1) 0 (2) 0 (3) 0
(4) 0 (5) 0 (6) 0
sqlwarn : (1) (2) (3) (4) (5) (6)
(7) (8) (9) (10) (11)
sqlstate: 22007

Jun 9 '06 #1
Share this Question
Share on Google+
14 Replies


P: n/a
peteh wrote:
Hi All;
We have many production jobs that "load from cursor" to a UDB/AIX 8.2
(with dpf) data warehouse from source tables residing Oracle 9i. Since
Oracle dates are (roughly) equivalent to DB2 timestamps, we frequently
use the date() function to "convert" from the Oracle date datatype to
the DB2 date datatype.

We have used this technique on over 20 Oracle tables for several months
with no problem. One table in particular fails with a sqlcode -180
(invalid db2 date value). Does anyone why we might be seeing this?.
Could it be that Oracle supports dates outside the range of that which
is supported by db2?


You get the same error if you run the query as is (w/o cursor or the load)
on the command line? If yes, then you should try to narrow down which rows
are failing and then have a look at the Oracle DATE value there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jun 9 '06 #2

P: n/a
> > snip<<
We have used this technique on over 20 Oracle tables for several months
with no problem. One table in particular fails with a sqlcode -180
(invalid db2 date value). Does anyone why we might be seeing this?.
Could it be that Oracle supports dates outside the range of that which
is supported by db2?


You get the same error if you run the query as is (w/o cursor or the load)
on the command line? If yes, then you should try to narrow down which rows
are failing and then have a look at the Oracle DATE value there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


Thanks Knut;
Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H

Jun 12 '06 #3

P: n/a
peteh wrote:
snip<<
We have used this technique on over 20 Oracle tables for several months
with no problem. One table in particular fails with a sqlcode -180
(invalid db2 date value). Does anyone why we might be seeing this?.
Could it be that Oracle supports dates outside the range of that which
is supported by db2?

You get the same error if you run the query as is (w/o cursor or the load)
on the command line? If yes, then you should try to narrow down which rows
are failing and then have a look at the Oracle DATE value there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


Thanks Knut;
Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H


I suspect the problem is operator error rather than Oracle:

SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jun 12 13:26:29 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> CREATE TABLE datedemo (
2 datecol DATE);

Table created.

SQL> INSERT INTO datedemo
2 (datecol)
3 VALUES
4 (TO_DATE('31-DEC-9999', 'DD-MON-YYYY'));

1 row created

SQL> commit;

Commit complete.

SQL> SELECT TO_CHAR(datecol, 'DD-MON-YYYY')
2 FROM datedemo;

TO_CHAR(DATECOL,'DD-
--------------------
31-DEC-9999

SQL>
--
Daniel A. Morgan
University of Washington
da******@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Jun 12 '06 #4

P: n/a
DA Morgan wrote:
peteh wrote:
snip<<
We have used this technique on over 20 Oracle tables for several months
with no problem. One table in particular fails with a sqlcode -180
(invalid db2 date value). Does anyone why we might be seeing this?.
Could it be that Oracle supports dates outside the range of that which
is supported by db2?
You get the same error if you run the query as is (w/o cursor or the
load)
on the command line? If yes, then you should try to narrow down which
rows are failing and then have a look at the Oracle DATE value there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


Thanks Knut;
Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H


I suspect the problem is operator error rather than Oracle:

SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jun 12 13:26:29 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> CREATE TABLE datedemo (
2 datecol DATE);

Table created.

SQL> INSERT INTO datedemo
2 (datecol)
3 VALUES
4 (TO_DATE('31-DEC-9999', 'DD-MON-YYYY'));

1 row created

SQL> commit;

Commit complete.

SQL> SELECT TO_CHAR(datecol, 'DD-MON-YYYY')
2 FROM datedemo;

TO_CHAR(DATECOL,'DD-
--------------------
31-DEC-9999


You have a different scenario here. The OP has a query like

SELECT datecol
FROM datedemo
WHERE datecol > '31-DEC-9999'

(whatever date format that is supposed to be)

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jun 13 '06 #5

P: n/a
peteh wrote:
snip<< Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H

DA Morgan wrote: I suspect the problem is operator error rather than Oracle:

BIG SNIP> --


Hi Daniel;
Your example seems to have little relevance to the problem I'm seeing.
If you'll notice in my previous post, Oracle returns the row with a
WHERE clause of date > '31-DEC-9999'" and shows a value of '16-APR-39'
in the date that meets this criteria. I stand by my assertion that
this certainly APPEARS to be a bug...

Pete H

Jun 13 '06 #6

P: n/a
Knut Stolze wrote:
DA Morgan wrote:
peteh wrote:
> snip<<
> We have used this technique on over 20 Oracle tables for several months
> with no problem. One table in particular fails with a sqlcode -180
> (invalid db2 date value). Does anyone why we might be seeing this?.
> Could it be that Oracle supports dates outside the range of that which
> is supported by db2?
You get the same error if you run the query as is (w/o cursor or the
load)
on the command line? If yes, then you should try to narrow down which
rows are failing and then have a look at the Oracle DATE value there.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Thanks Knut;
Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H

I suspect the problem is operator error rather than Oracle:

SQL*Plus: Release 10.2.0.2.0 - Production on Mon Jun 12 13:26:29 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> CREATE TABLE datedemo (
2 datecol DATE);

Table created.

SQL> INSERT INTO datedemo
2 (datecol)
3 VALUES
4 (TO_DATE('31-DEC-9999', 'DD-MON-YYYY'));

1 row created

SQL> commit;

Commit complete.

SQL> SELECT TO_CHAR(datecol, 'DD-MON-YYYY')
2 FROM datedemo;

TO_CHAR(DATECOL,'DD-
--------------------
31-DEC-9999


You have a different scenario here. The OP has a query like

SELECT datecol
FROM datedemo
WHERE datecol > '31-DEC-9999'

(whatever date format that is supposed to be)


A string is not a date. The above query may work with an implicit
type conversion but Oracle clearly states that this is neither
recommended nor guaranteed to work.

But again this seems like operator error. See the following:
SQL*Plus: Release 10.2.0.2.0 - Production on Tue Jun 13 09:12:01 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> desc datedemo
Name Null? Type
----------------------------------------- -------- ------------------
DATECOL DATE

SQL> select * from datedemo;

DATECOL
---------
31-DEC-99

SQL> SELECT datecol
2 FROM datedemo
3 WHERE datecol > TO_DATE('31-DEC-9999');

no rows selected

SQL>

--
Daniel A. Morgan
University of Washington
da******@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Jun 13 '06 #7

P: n/a
peteh wrote:
peteh wrote:
> snip<<
Yes - the query fails with or without the load. Turns out that although
Oracle claims to support a max date value of 9999-12-31, we managed to
get a single row into this table that even Oracle can't show us! When
querying Oracle directly with a WHERE clause of "date > '31-DEC-9999'",
we see a single row with a value of '16-APR-39' (?) Go figure... Assume
this is an Orace bug (say it ain't so!). Google shows at least one
other person encountering this mystery in the oracle group... Thanks
for your help. Looks like we'll need to hit up Oracle support and/or
filter for dates between '0001-01-01' and '9999-12-31'

Pete H

DA Morgan wrote:
I suspect the problem is operator error rather than Oracle:

BIG SNIP> --


Hi Daniel;
Your example seems to have little relevance to the problem I'm seeing.
If you'll notice in my previous post, Oracle returns the row with a
WHERE clause of date > '31-DEC-9999'" and shows a value of '16-APR-39'
in the date that meets this criteria. I stand by my assertion that
this certainly APPEARS to be a bug...

Pete H


1. What version
2. Dates, in Oracle, are not strings ... use TO_DATE
3. Why is this in the DB2 usenet group? If you wish to pursue it lets
be courteous and take it to comp.databases.oracle.server.
--
Daniel A. Morgan
University of Washington
da******@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Jun 13 '06 #8

P: n/a
DA Morgan wrote:
3. Why is this in the DB2 usenet group? If you wish to pursue it lets
be courteous and take it to comp.databases.oracle.server.


Pete was accessing an Oracle DB through the federated capabilities of DB2
(or rather Information Integrator). So the problem may have been with the
DB2->Oracle wrapper, which we could rule out.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jun 13 '06 #9

P: n/a
DA Morgan wrote:
SQL> SELECT datecol
2 FROM datedemo
3 WHERE datecol > TO_DATE('31-DEC-9999');


What does the query return if you omit the TO_DATE function call?

I'm asking because there may be an issue in the Oracle wrapper. If so, it
would be good to get it fixed.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jun 13 '06 #10

P: n/a
Knut Stolze wrote:
DA Morgan wrote:
SQL> SELECT datecol
2 FROM datedemo
3 WHERE datecol > TO_DATE('31-DEC-9999');


What does the query return if you omit the TO_DATE function call?

I'm asking because there may be an issue in the Oracle wrapper. If so, it
would be good to get it fixed.


Thanks. It seems likely your analysis is correct.
--
Daniel A. Morgan
University of Washington
da******@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Jun 13 '06 #11

P: n/a
DA Morgan wrote:

1. What version Oracle 9.2.0.7.0 on AIX
2. Dates, in Oracle, are not strings ... use TO_DATE Of course I understand this. I have run the following query via
SQLPlus:
select constrstockoutdate
from stsc.skustatstatic
where constrstockoutdate >= TO_DATE('31-DEC-9999');
~
CONSTRSTO
---------
16-APR-39

As you can see, the column "constrstockoutdate" (defined as an Oracle
DATE), appears to meet criteria suggesting that it is larger than
Oracle's maximum allowable value for a DATE column. The column is
populated by a 3rd party application for which I do not have the code
(we are working with the vendor - who as it turns out is working with
Oracle).
3. Why is this in the DB2 usenet group? If you wish to pursue it lets
be courteous and take it to comp.databases.oracle.server.

If you will look at the thread history, you will see that the problem
1st manifested itself via DB2 federated access to the data in question.
It was only after seeing funky things in native Oracle queries that I
started questioning Oracle iself. As far as taking the issue to
comp.databases.oracle.server, I hate to x-post and find the discourse
in this group to be slightly more civilized and interested in
problem-solving. We are able to work around the problem in our DB2
environment by filtering on date ranges outside of the year 0001 and
9999 (which might be necessary anyway since Oracle supports negative
year values representing years BC).

Please feel free to post any or all of this thread in
comp.databases.oracle.server

Pete H

Jun 13 '06 #12

P: n/a

Knut Stolze wrote:
Pete was accessing an Oracle DB through the federated capabilities of DB2
(or rather Information Integrator). So the problem may have been with the
DB2->Oracle wrapper, which we could rule out.


Thanks Knut - but I think the wrapper is doing its job throwing a -180
for a non-valid DB2 date/timestamp format (see my post below). The only
mystery to me at this point is how that one row of data greater than
12/31/9999 got into the source dbms.

Pete H

Jun 13 '06 #13

P: n/a
peteh wrote:
Knut Stolze wrote:
Pete was accessing an Oracle DB through the federated capabilities of DB2
(or rather Information Integrator). So the problem may have been with the
DB2->Oracle wrapper, which we could rule out.


Thanks Knut - but I think the wrapper is doing its job throwing a -180
for a non-valid DB2 date/timestamp format (see my post below). The only
mystery to me at this point is how that one row of data greater than
12/31/9999 got into the source dbms.

Yep. Do you have a corrupted database which has remained undetected, or
was it just a bug (which may or may not have long been fixed) in Oracle
on the INSERT/UPDATE statement.
Not knowing the misc. bits configurations of Oracle. Are sanity bits and
checksums always on in Oracle?
Could it be that e.g. half a page was written... (e.g. DB2 protects
against that by toggling the first and last bit of a page).
I guess punting to the Oracle NG may be the right action.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Jun 13 '06 #14

P: n/a
peteh wrote:
DA Morgan wrote:
1. What version

Oracle 9.2.0.7.0 on AIX
2. Dates, in Oracle, are not strings ... use TO_DATE

Of course I understand this. I have run the following query via
SQLPlus:
select constrstockoutdate
from stsc.skustatstatic
where constrstockoutdate >= TO_DATE('31-DEC-9999');
~
CONSTRSTO
---------
16-APR-39

As you can see, the column "constrstockoutdate" (defined as an Oracle
DATE), appears to meet criteria suggesting that it is larger than
Oracle's maximum allowable value for a DATE column. The column is
populated by a 3rd party application for which I do not have the code
(we are working with the vendor - who as it turns out is working with
Oracle).
3. Why is this in the DB2 usenet group? If you wish to pursue it lets
be courteous and take it to comp.databases.oracle.server.

If you will look at the thread history, you will see that the problem
1st manifested itself via DB2 federated access to the data in question.
It was only after seeing funky things in native Oracle queries that I
started questioning Oracle iself. As far as taking the issue to
comp.databases.oracle.server, I hate to x-post and find the discourse
in this group to be slightly more civilized and interested in
problem-solving. We are able to work around the problem in our DB2
environment by filtering on date ranges outside of the year 0001 and
9999 (which might be necessary anyway since Oracle supports negative
year values representing years BC).

Please feel free to post any or all of this thread in
comp.databases.oracle.server

Pete H


Looks like a problem specific to an earlier version of Oracle as you can
see:

SQL*Plus: Release 10.2.0.2.0 - Production on Wed Jun 14 09:50:38 2006

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> desc datedemo
Name Null? Type
----------------------------------------- -------- ------------------
DATECOL DATE

SQL> select * from datedemo
2 where datecol >= TO_DATE('31-DEC-9999');

DATECOL
---------
31-DEC-99

SQL>
--
Daniel A. Morgan
University of Washington
da******@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Jun 14 '06 #15

This discussion thread is closed

Replies have been disabled for this discussion.