我想知道如何在 MySQL 中定义或声明内表
我是 MySQL 新手,不知道语法
如你所见,我创建了存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `MySP`(
actioncode VARCHAR(5),
TNewsID BIGINT
)
BEGIN
IF actioncode = 1 then -- Retrive all from the database --
select *
from emp.tbnews;
elseIF actioncode = 2 then -- Retrive all from the database By NewsID --
select NewsID,NewsSubject,NewsSubjectAR,NewsDetails,NewsDetailsAR,CreatedOn,DisplayOrder,
AllowDisplay,img
from emp.tbnews
Where NewsID=TNewsID;
elseIF actioncode = 3 then -- fkjskldfjklsdf --
select NewsID,NewsSubject,NewsSubjectAR,NewsDetails,NewsDetailsAR,CreatedOn,DisplayOrder,
AllowDisplay,img
from emp.tbnews;
END IF;
END
我真正想要的是在 IF 语句之前声明内部表
在 Sql Server 中我这样做
declare @tbTemp table (
a as int,
b as char...etc.
)
因为我想在后面添加插入语句
IF actioncode = 1
Insert into @tbTemp
所以如果你知道的话请告诉我怎么做
向每一个人致以最诚挚的问候。