About the choice of data types in Oracle

Source: Internet
Author: User

As a beginner, made the following error:

The millisecond value of the current time when generating the table's primary key ID. When you define a primary key ID in Oracle, the data type is char (32). The data can not be taken out by ID in MyBatis. Think for a few days, was supposed to be the browser to take the ID is empty value, so the trim () function to remove the null value, but still no data, finally found that the data type in the database is defined as fixed length, the current time of the millisecond value is only 16 bits, and char (32) is a fixed length of 32 bits, This means that there are 16 spaces, all of which cannot be taken out of the data. Try to change char (32) to VARCHAR2 (32), re-query, everything is OK.

The problem is solved, but it is not advisable to use the millisecond value of the current time as the ID, so it is changed to a fixed length of 32 of the UUID generated as an ID. Re-changed the ID data type to char (32). The problem is solved, the New Year's Day, looking for several days. Say more is all tears.

About the choice of data types in Oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.