帮忙看下这个存储过程是否有问题?谢谢了

一魅 一魅 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
CREATE PROCEDURE HD_Insert_Every_Acount_Every_Commidity_All_Things(
Acount_Id bigint(11),
Spread_profits_sum float(11),
Market_price_profits_sum double,
Total_reward_ratio float(10),
Acount_Num int(10),
Acount_Suc_Num int(10),
Win_rate float(10),
Avg_profit_point float(11),
Avg_loss_point float(11),
Profit_loss_ratio float(11),
Annual_return float(11),
IAcount_Type int(11),
Commodity_id int(10)
)
BEGIN
declare iCount INT default 0;
IF(IAcount_Type = 0)THEN
set iCount = (select count(*) from t_account_commodity_all where account_id = Acount_Id);
IF (iCount = 0) THEN
insert into t_account_commodity_all ( account_id,total_profit_points,profit_loss_money,total_reward_ratio,trade_count,profit_trade_count,win_rate,avg_profit_point,avg_loss_point,profit_loss_ratio,annual_return,commodity_id ) values
( Acount_Id,Spread_profits_sum,Market_price_profits_sum,Total_reward_ratio,Acount_Num,Acount_Suc_Num,Win_rate,Avg_profit_point,Avg_loss_point,Profit_loss_ratio,Annual_return,Commodity_id);
ELSE
update t_account_commodity_all
set total_profit_points = Spread_profits_sum, profit_loss_money = Market_price_profits_sum, total_reward_ratio =Total_reward_ratio,trade_count =Acount_Num,
profit_trade_count = Acount_Suc_Num,win_rate = Win_rate,avg_profit_point = Avg_profit_point,avg_loss_point = Avg_loss_point,profit_loss_ratio = Profit_loss_ratio,annual_return = Annual_return
where account_id = Acount_Id and commodity_id = Commodity_id;
END IF;
END IF;
END
...全文

相关推荐

sql 判断数据库,表,存储过程等是否存在的代码

代码: --库是否存在 if exists(select * from master..sysdatabases where name=N'库名') print 'exists' else print 'not exists' --------------- -- 判断要创建的表名是否存在 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -- 删除表 drop table [dbo].[表名] GO -

发亮日渐稀疏

存储过程

1、什么是存储过程? 把一堆SQL语句放在一起,还可以根据条件执行不通SQL语句。 2、为什么要使用存储过程? 比单纯SQL语句执行要快。 3、存储过程优点: 1.允许模块化的设计,就是说只需创建一次,以后在该程序中就可以调用多次。 2.如果某次操作需要执行多次SQL ,使用存储过程比单纯SQL语句执行要快。 3.可重复使用,能减少网络流量,还具有安全性。 4、存储过程缺点: 1.调试麻烦,但是用 PL/SQL Developer 调试很方便!弥补这个缺点。 2.移植问题,数据库端代码当然是与数据库相关的。但是如果是做工程型项目,基本不存在移植问题。 3.重新编译问题。 存储过程规范写法 -

weixin_38645865

ORACLE存储过程中定义数组并且判断某值是否在数组中.txt

ORACLE存储过程中定义数组并且判断某值是否在数组中。有例子可執行、 、有例子可執行、

BennyLu2019

sqlserver 快速查询存储过程是否用到某个表或者字段

sqlserver 快速查询存储过程或者视图中是否用到某个表或者字段。

幸福了就微笑

oracle存储过程编译错误问题

NULL 博文链接:https://forlab.iteye.com/blog/1821751

weixin_38669628
评论 5
收藏 已收藏
分享
返回顶部
一魅
MySQL 57,062 成员 56,759 内容