关于腾讯云开发环境的 mysql 的语法
发布于 6 年前 作者 leifu 11016 次浏览 来自 问答
  • 需求的场景描述(希望解决的问题)

在phpMyAdmin mysql 中写:

declare temp_cur cursor for select f_user_id from table_test where f_user_id=1;

报错:

错误

静态分析:

分析时发现1个错误。

Unrecognized statement type. (near “declare” at position 0)

SQL 查询: 文档

declare temp_cur cursor for select f_user_id from table_test where f_user_id=1

MySQL 返回: 文档

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘declare temp_cur cursor for select f_user_id from table_test where f_user_id=1’ at line 1

  • 希望提供的能力

请问 这怎么解决?

2 回复

https://dev.mysql.com/doc/refman/8.0/en/declare.html

DECLARE is permitted only inside a BEGIN … END compound statement and must be at its start, before any other statements.是否没有BEGIN和END?

怎么解决?

回到顶部