问题
I am very new in iseries/DB2.
We use V7R3. We have table that is generated every day by RPG program as physical file. For accessing the table data from java we use jt400.jar jdbc driver.
Most of the table queries work fine but some complex queries that are using "DENSE_RANK() OVER(ORDER BY" and "ROW_NUMBER() OVER(PARTITION BY" time to time hanging and causing CPU 100%. only killing the job on AS400 side is resolving the issue.
in the AS400 log I see:
Job 969954/QUSER/QZDASOINIT started on 02/21/19 at 09:36:46 in subsystem
QUSRWRK in QSYS. Job entered system on 02/21/19 at 09:36:46.
User USERXX from client X.X.X.X connected to server.
Use of function TIMESTAMP_FORMAT in QSYS2 not valid.
Use of function TIMESTAMP_FORMAT in QSYS2 not valid.
Data mapping error on member TABLE_NAME.
Data mapping error on member TABLE_NAME.
Data mapping error on member TABLE_NAME.
Data mapping error on member TABLE_NAME.
Value in date, time, or timestamp string not valid.
It looks similar as problem described in the Why am I getting a "[SQL0802] Data conversion of data mapping error" exception? and probably the problem is related to invalid data stored to DATE type columns.
Looking to the DATE columns I see that some records displayed as <null>
in SQuirrel SQL Client. Interesting that here are 2 different <null>
's returned by distinct query.
If I run
select distinct VARCHAR_FORMAT(DATE_COLUMN, 'YYYY/MM/DD') from TABLE_NAME
I get
0001/01/01
and
9999/12/31
for these <null>
's rows.
if I run Select * from TABLE where DATE_COLUMN is null I don't get any results. So I am not sure what kind of <null>
's is that.
Not sure if these records can cause an issue.
UPD: when I run
Select * from TABLE
I see errors in JDBC client log:
Warning: [SQL0181] Value in date, time, or timestamp string not valid.
SQLState: 01534
ErrorCode: 181
Warning: [SQL0181] Value in date, time, or timestamp string not valid.
SQLState: 01534
ErrorCode: 181Warning: [SQL0181] Value in date, time, or timestamp string not valid.
SQLState: 01534
ErrorCode: 181
Warning: [SQL0181] Value in date, time, or timestamp string not valid.
SQLState: 01534
ErrorCode: 181
Query 1 of 1, Rows read: 100, Elapsed time (seconds) - Total: 0.252, SQL query: 0.005, Reading results: 0.247
based on https://www.consolut.com/en/s/sap-ides-access/d/s/p/40/doc/XH-SQL0181/ it should be incorrect date somewhere in the table
The question is there any way to find and filter records that have "invalid" data (causing above exception in the log) from SQL side?
来源:https://stackoverflow.com/questions/55228909/use-of-function-timestamp-format-in-qsys2-not-valid-data-mapping-error-on-membe