MySQL stored procedure, the meaning of the variable before the @

2010-08-06  来源:本站原创  分类:Database  人气:176 

MySQL stored procedure variables in front of the @ sign on behalf of a session variable, the scope is the current login account, DECLARE variables declared within a stored procedure is only effective.

mysql> delimiter / /
mysql> CREATE PROCEDURE pro2 ()
-> BEGIN
-> DECLARE d int;
-> SELECT MAX (id) INTO d from php_coder;
-> SET @ dd = 0;
-> SELECT MAX (id) INTO @ dd FROM php_coder;
-> END;
-> / /
Query OK, 0 rows affected (0.00 sec)

mysql> call pro2 ();
-> / /
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT @ dd;
-> / /
+------+
| @ Dd |
+------+
| 7 |
+------+
1 row in set (0.00 sec)

mysql> SELECT d / /
ERROR 1054 (42S22): Unknown column 'd' in 'field list'

相关文章
  • MySQL stored procedure, the meaning of the variable before the @ 2010-08-06

    MySQL stored procedure variables in front of the @ sign on behalf of a session variable, the scope is the current login account, DECLARE variables declared within a stored procedure is only effective. mysql> delimiter / / mysql> CREATE PROCEDURE pro

  • Transfer: mysql stored procedure Detailed 2010-11-30

    Detailed MySQL stored procedure Transfer from: http://www.owe-love.com/myspace/?action=show&id=187 1. Stored Procedures Introduction We used to operate the database language SQL statements executed when the need first compiled, then executed, and sto

  • MySQL stored procedure example, include a transaction, parameters, nested calls, cursor, loop, etc. 2010-02-07

    MySQL stored procedure example, include a transaction, parameters, nested calls, cursor, circulation, reading examples of MySQL stored procedures, including services, parameters, nested calls, cursor, loop, etc., view plaincopy to clipboardprint? Dro

  • (Transfer) MySQL stored procedure parameters, there are three types: in.out.inout. They have any effect and characteristic? 2010-04-11

    1, MySQL stored procedure parameters (in) MySQL stored procedure "in" parameters: a function with C-value of the parameter passed similar, MySQL stored procedure may be modified within this parameter, but changes in the type parameter of the cal

  • MySQL stored procedure to learn 2010-05-25

    2 good MySQL stored procedure articles to learn, to share learning addresses saved. http://www.javaeye.com/topic/136203 (MySQL stored procedure to learn a) http://www.javaeye.com/topic/136202 (MySQL stored procedure to learn 2) I saw the article, the

  • Learning MySQL stored procedure 2010-05-25

    2 good MySQL stored procedure articles to learn, to share learning addresses saved. http://www.javaeye.com/topic/136203 (MySQL stored procedure to learn a) http://www.javaeye.com/topic/136202 (MySQL stored procedure to learn 2) I saw the article, the

  • MySQL stored procedure parameters usage in, out, inout (change) 2010-06-22

    MySQL stored procedure parameters, there are three types: in, out, inout. What role and characteristics they have it? 1, MySQL stored procedure parameters (in) MySQL stored procedure "in" parameters: a function with C-value of the parameter pass

  • The basic syntax of mysql stored procedure articles 2010-06-24

    Learning the basic grammar of the main reference to the mysql User's Guide Mysql database stored procedure needs to have proc Table. The table created during the MySQL 5.1 installation. If you are upgrading from an earlier version to MySQL 5.1, make

  • Instance of MySQL stored procedure 2010-07-02

    Begin later version of MySQL 5.0 support stored procedures, stored procedures, consistency, efficiency, security and architecture characteristics, through specific examples in this section explain how to manipulate PHP MySQL stored procedures. Exampl

  • Mysql stored procedure Study Notes 2010-09-19

    Today, writing a Mysql stored procedure encountered a very strange problem. I use Mysql client is Navicat 8 for MySQL. I create a query, and then write a stored procedure completed, executed successfully. However, from inquiries which the Executive C

  • Basic use of Mysql stored procedure 2010-09-28

    We all know that MySQL stored procedures from MySQL 5.0 to add new features gradually. Stored procedures are also advantages in practical application than disadvantages. But the most important thing is the efficiency and SQL code packages. SQL code i

  • MySQL stored procedure debugger? 2010-11-17

    The last mentioned work to write a stored procedure, a lot of trouble, do not know how to debug, MySQL stored procedure has no debugging tool 1. Laodeng to the proposal is to create a temporary table, insert some of the stored procedure debug informa

  • Mysql stored procedure to learn introductory programming summary 2011-01-14

    After continuous failures and validate their own can finally feel at ease to write a stored procedure. Now in the process put into the issue and share with everyone. Later, the Internet has seen a lot of people have similar experiences. I have compil

  • Detailed mysql stored procedure 2010-09-08

    Transfer: http://hi.baidu.com/fangyuan28/blog/item/061ae434ffef8743251f149d.html Detailed mysql stored procedure 1, the premise requires MySQL 5 2, Hello World MySQL stored procedures of the Hello World DELIMITER $ $ DROP PROCEDURE IF EXISTS HelloWor

  • Mysql stored procedure, the basic usage 2010-09-28

    We all know that MySQL stored procedures from MySQL 5.0 began to add new features. Stored procedures advantages in practical applications is greater than the disadvantages. But the most important thing is the efficiency and SQL code packages. Particu

  • MySQL stored procedure example 2010-12-12

    MySQL 5.0 later version supports stored procedures, stored procedures with consistency, efficiency, security and architecture characteristics, through specific examples in this section explain how to manipulate PHP MySQL stored procedure. Examples in

  • MySQL stored procedure parameters usage in, out, inout 2011-05-28

    MySQL stored procedure parameters, there are three types: in, out, inout. What is the role and characteristics they have it? A, MySQL stored procedure parameters (in) MySQL Stored Procedures "in" parameters: C language function with parameter pa

  • mysql stored procedure 2010-04-16

    MYSQL stored procedure where, if I want to enter as "a, 3,100, qwe" such a string, how to remove the comma insert the table, arranged in the table a 3 100 qwe This form is to each field separated by a comma inserted into each row of the table. c

  • mysql stored procedure syntax to learn 2010-05-14

    mysql stored procedure syntax to learn Description: A stored procedure, including name, parameter list, and may include many SQL statements SQL statement set. Including the name of a stored procedure, parameter list, and may include many SQL statemen

  • JAVA MYSQL stored procedure call 2010-06-21

    JAVA MYSQL stored procedure call Project view: Code list: myconn.java view plaincopy to clipboardprint? package org.apache.sh_mysql.test; import java.sql .*; public class MyConn ( private static final String DRIVER = "com.mysql.jdbc.Driver"; pri