003 letter-Inserting data into an Oracle database, special handling when the field is allowed to be empty

Source: Internet
Author: User

The content of this blog is all from the Intelligence podcast, which is explained here.

Business requirements are as follows: When entering data on a JSP page, go to the background and enter into the database.

JSP page:

Field design for database:

Attention:

When some of the field content on the JSP page is empty, because the database fields are allowed to be empty, there is no mistake in thinking of doing so, in fact, MySQL is a good developer, but not with Oracle.

When using MyBatis, write the MyBatis configuration file as follows:

<InsertID= "Insert"ParameterType= "Cn.itcast.jk.domain.Factory"><!--When the database is Oracle, if the inserted data is empty, you must specify the default parameters. So here's the setting to write: Jdbctype=varchar.
MySQL database development does not have to specify Jdbctype=varchar so write. -insert into Factory_c (Factory_id,full_name,factory_name,contacts,phone,mobile,fax, Cnote,inspector,order_no,create_by,create_dept,create_time) VALUES (#{id,jdbctype=varchar},#{fullname,jdbctype=varchar },#{factoryname,jdbctype=varchar },#{contacts,< Span style= "color: #ff0000;" >jdbctype=varchar },#{phone,jdbctype=varchar },#{mobile,jdbctype=varchar },#{fax,jdbctype=varchar },#{cnote,jdbctype=varchar },#{inspector,jdbctype=varchar },#{orderno,jdbctype=integer },#{createby,jdbctype=varchar },#{createdept,jdbctype=varchar },#{createtime,jdbctype=timestamp }) </Insert>

I was afraid to use Oracle to develop this problem, so write this blog.

003 letter-Inserting data into an Oracle database, special handling when the field is allowed to be empty

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.