Development: DB2-related problems in the collection of exceptions

Source: Internet
Author: User
Tags db2 db2 sql error sql error

The first time with the DB2 database, due to the construction of the statement may not be the same, so the use of manual table-based approach, one field to fill. And check the primary key, and finally found that the creation failed. Look at the SQL statements generated by the system

The SQL statements are as follows:

CREATE TABLE FRONT. Score_reverse
(
Serial_no VARCHAR (50),
Secret_key VARCHAR (50),
tradebox_id INTEGER (32),
Reduce_point_type VARCHAR (50),
Reduce_point_reason VARCHAR (50),
Reduce_time VARCHAR (50),
Login_name VARCHAR (50),
commodity_id INTEGER (32),
Commodity_number VARCHAR (50),
Point INTEGER (32),
Contact_Name VARCHAR (50),
Contact_mobile_no VARCHAR (50),
Contact_address VARCHAR (50),
Commodity_type VARCHAR (50),
Reverse_time VARCHAR (50),
PRIMARY KEY (serial_no));


The following two errors are indicated:

First exception: [CREATE-0 row (s), 0.000 secs] [Error Code: -104, SQL state:42601] DB2 SQL error:sqlcode=-104, sqlstate=42601, Sqlerrmc=integer; R (50),

Because the online search does not want the answer, then directly see the problem, found hint sqlerrmc=integer; R () then removes the length of the integer and changes the integer (32) to Integer. Problem solving



Second exception: DB2 SQL error:sqlcode=-542, sqlstate=42831, Sqlerrmc=serial_no, driver=4.15.82

This is what I can't find. Search found that when DB2 creates a primary key, its primary key SQL must be set to not be empty. That is to be set to: serial_no VARCHAR (not null), and the system generates no NOT NULL


Re-modify SQL, execute OK again, table creation complete

Development: DB2-related problems in the collection of exceptions

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.