MySQL stored procedures

Source: Internet
Author: User

1 CREATE OR REPLACE PROCEDURE testpro (PARAM1 in varchar2,param2 in VARCHAR2) as2 BEGIN3 INSERT into TestTable (id,name) VALUES (PARAM1, PARAM2); 4 END Testpro; 5 Java code:6   7   Packagecom.dragon.test; 8   Importorg.springframework.jdbc.core.JdbcTemplate; 9    Public classJdbctemplatetest {Ten    PrivateJdbcTemplate JdbcTemplate;  One     Public voidsetjdbctemplate (JdbcTemplate jdbctemplate) { A     This. JdbcTemplate =JdbcTemplate;  - }    -      Public voidTest () { the       This. Jdbctemplate.execute ("Call Testpro (' P1 ', ' P2 ')");  -   }    -}

Toss me an afternoon, the original stored procedure required variable declaration type, to capitalize, or to give the size, the error report is not obvious

Reference

CREATE definer= ' @ ' PROCEDURE ' kll_adduser ' (weixin_id varchar, hotel_id int,hotel_name varchar), user_name varchar (user_cardid), User_phone varchar (),checkin_time varchar(200), Letter varchar )) Begininsert into Kh_userinfo (weixin_id,hotel_id,hotel_name,user_name,user_cardid,user_phone,checkin_time) Values (weixin_id,hotel_id,hotel_name,user_name,user_cardid,user_phone,checkin_time); Insert into Hk_share (user_ phone,user_cardid,art_content) VALUES (user_phone,user_cardid,letter); END

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.