我正在将Oracle
存储过程转换为MYSQL
,在下面的sql查询中如何在mysql中使用“IS”
CURSOR rout_acc_cursor
IS
(SELECT u06_exchange, u06_routing_ac_type,
DECODE (u06_routing_ac_type,
0, u06_exchange_ac,
1
) AS routing_ac,
u06_commision_type, u06_commision_amt_small,
u06_is_custodian_account, u06_commision_share, u06_txn_fee,
u06_commision_group_id, -1 AS u06_cond_orders, u06_symbol_cond,
0 AS u06_daydiscount, u06_trading_enabled
FROM u06_routing_accounts
WHERE u06_security_ac_id = sec_acc_id);
cur_var rout_acc_cursor%ROWTYPE;
答案 0 :(得分:1)
Try in this way
Declare rout_acc_cursor CURSOR For SELECT u06_exchange, u06_routing_ac_type,
DECODE (u06_routing_ac_type,
0, u06_exchange_ac,
1
) AS routing_ac,
u06_commision_type, u06_commision_amt_small,
u06_is_custodian_account, u06_commision_share, u06_txn_fee,
u06_commision_group_id, -1 AS u06_cond_orders, u06_symbol_cond,
0 AS u06_daydiscount, u06_trading_enabled
FROM u06_routing_accounts
WHERE u06_security_ac_id = sec_acc_id;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET HANDLER=1;
OPEN rout_acc_cursor
MAINlOOP:LOOP
Fetch rout_acc_cursor into var1,VAR2......;
if HANDLER=1 THEN
leave MAINloop;
close get_head_amount_CUR;
END If;
END LOOP MAINlOOP