在mysql写了一存储过程,编译没有问题,但是执行报Category Timestamp Duration Message Line Position
Error 2010-6-16 10:59:32 0:00:03.984 MySQL Database Error: Table 'questdebug.sys_columndictionary' doesn't exist 1 0 错误。
具体如下:
DROP PROCEDURE IF EXISTS db.pro_CrateTable;
CREATE PROCEDURE db.`pro_CrateTable`(tableGuID char(36))
BEGIN
declare tableName varchar(100);
declare sqlContent varchar(500);
declare codes varchar(5);
declare types varchar(20);
declare stop int default 0;
declare cur1 cursor for select ColumnCode,ColumnDataType from sys_columndictionary where TableID=tableGuID;
declare CONTINUE HANDLER FOR SQLSTATE '02000' SET stop=1;
select Code into tableName from sys_tabledictionary where id = tableGuID;
set sqlContent = CONCAT(' drop table if exists sys_ColumnDataType; create table ',tableName,'(rowid int not null,');
open cur1;
fetch cur1 into codes,types;
while stop <> 1 do
set sqlContent =CONCAT(sqlContent,codes,' ',types,',');
fetch cur1 into codes,types;
end while;
close cur1;
set sqlContent = substring(sqlContent,1,length(sqlContent)-1);
set sqlContent = CONCAT(sqlContent,' );');
select sqlContent;
END;
请大家指出错误
报的错误已经很明显了:questdebug.sys_columndictionary这个表不存在。
肯定是运行是出现错误了,查查你游标里面使用的表存在不的。