首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Informix >

informix存储过程的有关问题

2012-03-08 
informix存储过程的问题create procedure update_hme_tel()define ccd_act char(18)define hme_tel char(

informix存储过程的问题
create procedure update_hme_tel()
define ccd_act char(18);
define hme_tel char(20);

declare c1 cursor 
select ccd_act, hme_tel from act_hme_tel;
open c1
fetch next from c1 into ccd_act, hme_tel

select ccd_act, hme_tel into ccd_act, hme_tel from act_hme_tel;
update t_cc_ccd_cust set hme_tel= hme_tel
where ccd_act = ccd_act;

end procedure;

报201错误

[解决办法]
你把4gl和SP搞混了。
[解决办法]
供参考:
create procedure P_DealBankers()
RETURNING CHAR(255), CHAR(255);
DEFINE s_RespMsgCHAR(255);
DEFINE s_RespDataCHAR(255);

DEFINE iSqlCodeINTEGER;

DEFINE s_EntNo CHAR(10);
DEFINE s_TrDate CHAR(8);
DEFINE l_Serial INTEGER;

DEFINE s_DActNoCHAR(30);
DEFINE s_DCusNameCHAR(60);
DEFINE s_DOpenBankCHAR(10);
DEFINE s_DBankNameCHAR(60);
DEFINE s_CActNoCHAR(30);
DEFINE s_CCusNameCHAR(60);
DEFINE s_COpenBankCHAR(10);
DEFINE s_CBankNameCHAR(60);

LET iSqlCode = 0;
LET s_RespData = '';

LET s_EntNo = '';
LET s_TrDate = '';
LEt l_Serial = 0;

LET s_DActNo= '';
LET s_DCusName= '';
LET s_DOpenBank= '';
LET s_DBankName= '';
LET s_CActNo= '';
LET s_CCusName= '';
LET s_COpenBank= '';
LET s_CBankName= '';

FOREACH SELECT fc_DActNo, fc_CActNo, fc_TrDate, fi_Serial, fc_EntNo
INTO s_DActNo, s_CActNo, s_TrDate, l_Serial, s_EntNo
FROM TCAcctLst
WHERE fc_Flag = '1'

--tcbtcustact无101账户
IF (s_DActNo[1,3] = '101' OR s_CActNo[1,3] = '101') THEN
CONTINUE FOREACH;
END If

SELECT DISTINCT A.fc_bankno, A.fc_cusname, B.fc_bankName
INTO s_DOpenBank, s_DCusName, s_DBankName
FROM tcbtcustact A, OUTER Tbanklst B
WHERE A.fc_newact = s_DActNo
AND A.fc_bankno = B.fc_bankNo;
let iSqlCode = DBINFO('sqlca.sqlerrd2');
IF (iSqlCode = 0) THEN
CONTINUE FOREACH;
END IF

UPDATE TCAcctLst
SET fc_dcusname = s_DCusName,
fc_dopenbank = s_DOpenBank,
fc_dbankname = s_DBankName,
fc_ccusname = s_CCusName,
fc_copenbank = s_COpenBank,
fc_cbankname = s_CBankName
WHERE fc_trdate = s_TrDate
AND fi_Serial = l_Serial
AND fc_entno = s_EntNo
AND fc_dactno = s_DActNo
AND fc_cactno = s_CActNo
;

END FOREACH

LET s_RespMsg='Response=00000|';
RETURN s_RespMsg, s_RespData;

END PROCEDURE;

[解决办法]
declare c1 cursor
select ccd_act, hme_tel from act_hme_tel;
open c1
fetch next from c1 into ccd_act, hme_tel

这个是什么语法啊?
[解决办法]

SQL code
create procedure update_hme_tel()define ccd_act char(18);define hme_tel char(20);foreach select ccd_act, hme_tel into ccd_act ,hme_tel  from act_hme_telupdate t_cc_ccd_cust set hme_tel= hme_telwhere ccd_act = ccd_act;end foreach;end procedure; 

热点排行