mysql过程转换为oracle~ 怎么处理?

CREATEDEFINER='root'@'%'TRIGGERledianv3_1.insert_productstockopeBEFOREINSERTONledianv... CREATE
DEFINER = 'root'@'%'
TRIGGER ledianv3_1.insert_productstockope
BEFORE INSERT
ON ledianv3_1.product_stockope
FOR EACH ROW
BEGIN
UPDATE product_stockopeitems SET newnum = num WHERE opeid = new.id;
SET new.num = (SELECT SUM(num) FROM product_stockopeitems WHERE opeid = new.id);
IF new.opetype in (1,3) AND new.status=3 THEN
INSERT INTO product_stockinfor (memberid, wareid, proitemsid, forsale, stockhis, onselltime)
SELECT new.memberid,wareid,proitemsid,newnum,newnum,NOW() FROM product_stockopeitems WHERE opeid = new.id
ON DUPLICATE KEY UPDATE forsale = forsale + VALUES(forsale), stockhis = stockhis + VALUES(stockhis), offselltime = NULL;
END IF;
IF new.opetype = 2 AND new.status=3 THEN
UPDATE product_stockinfor a, product_stockopeitems b SET a.forsale = a.forsale - b.newnum,a.stockhis = a.stockhis - b.newnum
WHERE b.opeid = new.id AND a.memberid = new.memberid AND a.wareid = b.wareid AND a.proitemsid = b.proitemsid;
END IF;
END
展开
 我来答
198901245631
2015-04-02 · TA获得超过3.5万个赞
知道大有可为答主
回答量:9037
采纳率:92%
帮助的人:1722万
展开全部
你好:可以先创建好对应的表后,直接创建一个空存储过程,吧这个存储过程拿过去,直接编译,那里报错改那里就可以了:CREATE
DEFINER = 'root'@'%'
TRIGGER ledianv3_1.insert_productstockope
BEFORE INSERT
ON ledianv3_1.product_stockope
FOR EACH ROW
这些代码需要自己重新定义,下面的额基本上可以复用
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式