码迷,mamicode.com
首页 > 数据库 > 详细

Prepared SQL Statement Syntax

时间:2016-12-28 14:46:26      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:show   exe   values   sql   variable   creat   statement   from   blog   

 

http://dev.mysql.com/doc/refman/5.7/en/sql-syntax-prepared-statements.html

 

1 CREATE TABLE t1 (a INT NOT NULL);
2 INSERT INTO t1 VALUES (4), (8), (11), (32), (80);
3 SET @table = t1;
4 SET @s = CONCAT(SELECT * FROM , @table);
5 PREPARE stmt3 FROM @s;
6 EXECUTE stmt3;

 

 

1 SET @s = SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse;
2 PREPARE stmt2 FROM @s;
3 SET @a = 6;
4 SET @b = 8;
5 EXECUTE stmt2 USING @a, @b;

 

 

1 PREPARE stmt1 FROM SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse;
2 SET @a = 3;
3 SET @b = 4;
4 EXECUTE stmt1 USING @a, @b;
5 SHOW VARIABLES LIKE %a%;

 

Prepared SQL Statement Syntax

标签:show   exe   values   sql   variable   creat   statement   from   blog   

原文地址:http://www.cnblogs.com/yuanjiangw/p/6229302.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!