记录一个小问题:游标中声明排序的写法问题
开始写
declare mycursor cursor for
( select * from tableName)
deallocate mycursor
( select * from tableName)
deallocate mycursor
没有问题
加上排序
declare mycursor cursor for
( select * from tableName order by field1 )
deallocate mycursor
提示order 附近有语法错误( select * from tableName order by field1 )
deallocate mycursor
最后发现正确写法
declare mycursor cursor for
select * from tableName order by field1
deallocate mycursor
或者select * from tableName order by field1
deallocate mycursor
declare mycursor cursor for
( select * from tableName ) order by field1
deallocate mycursor
( select * from tableName ) order by field1
deallocate mycursor