Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
如果已使用给定名创建或声明了用户定义变量,则返回 1。如果未创建这样的变量,则返回 0。
VAREXISTS( variable-name-string )
variable-name-string 要测试的变量名(字符串形式)。
INT
SQL/2008 服务商扩充。
以下 IF 语句创建一个名为 start_time 的变量(如果尚未创建或声明该变量)。之后便可安全地使用该变量。
IF VAREXISTS( 'start_time' ) = 0 THEN CREATE VARIABLE start_time TIMESTAMP; END IF; SET start_time = current timestamp;