Page 1 of 1

Incorrect Date on Lookup Table

Posted: Mon Jun 17, 2024 6:37 pm
by Trosmada

Dear friends,

I have tables :

  1. treatdetail, with fields:
    wh_code, inv_code, exp_date
  2. (from view) expinventory, with fields:
    wh_code, inv_code, exp_date, quantity

from treatdetail->exp_date, lookup to lookup table expinventory (link field is exp_date)
parent field #1 wh_code
parent field #2 inv_code

But when it runs, it appear error warning (even though we can continue), the error is as below:
...vendor\doctrine\dbal\src\Driver\API\MySQL\ExceptionConverter.php(117): An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: '108305'

(please note that the value of DATE value in error message keep on changing).

Last month -- it works well - without above error. (this program is still in trial phase, I just revisit this again this month)
I don't know how to fix it.

I am using WAMPSERVER 3.3.5
MySQL 8.3.0

Kindly share what to do. Thanks in advanced


Re: Incorrect Date on Lookup Table

Posted: Tue Jun 18, 2024 9:40 am
by arbei

Note that when your parent fields have no values, a random number will be used as the link field value so the lookup for the child field will return no values. However, for DATE data type, a random number is not a correct value, hence the error. If possible, avoid using DATE or DATETIME type as link field (they may not be unique). If you need to, you may try TIMESTAMP.


Re: Incorrect Date on Lookup Table

Posted: Wed Jun 19, 2024 1:02 pm
by Trosmada

Thanks.

I just found the problem.
Why last month I said that it works well. I realized that I change the database from MariaDB to MySql. Then I change the collation from utf8mb4_unicode_520_ci to utf8mb4_0900_ai_ci, other things just works well, then when I tried the lookup table (with date as link field) then that error occurs.

I just tried again - back to MariaDB and change the collation to utf8mb4_unicode_520_ci

Then there is no error, everything works well.

Thanks again for your reply. Blessings