CREATE Procedure SP_UpdateDIV
(IN CMP_KIND_C varchar (3),
IN CALL_YN varchar (1),
IN ACNO varchar (14)
)
LANGUAGE SQL
BEGIN
Declare QENDYNX varchar (2);
Declare QENDYN varchar (2);
Declare QRRNO varchar (13);
Declare QOUT_ACD varchar (5);
Declare QCAMP_ID varchar (20);
IF CALL_YN = 'Y' THEN
SET QENDYNX = 'N';
ELSE
SET QENDYNX = 'X';
END IF;
EXEC SQL DECLARE c0 CURSOR FOR
Select RRNO, Out_acd, camp_id,END_YN From TB_Out_DIV
a Left Outer Join TB_Cust_Info b On a.Camp_ID = CMP_KIND_C
and a.RRNO = b.RRNO
and a.CAMP_ID = b.CAMP_ID ;
EXEC SQL OPEN c0;
EXEC SQL FETCH c0 INTO :QRRNO, :QOUT_ACD :QCAMP_ID:QENDYN;
while (sqlca.sqlcode != 100)
{
IF QENDYN <> 'Y' THEN
UPDATE TB_OUT_DIV SET END_YN = QENDYNX WHERE RR_NO = QRRNO AND OUT_ACD = QOUT_ACD AND CAMP_ID = QCAMP_ID
END IF;
EXEC SQL FETCH c0 INTO :QRRNO, :QOUT_ACD :QCAMP_ID:QENDYN;
}
EXEC SQL CLOSE c0;
END;
이렇게 만들려구 하는데 생성이 안되네여.. 머가 잘못된건지 잘모르겠습니다.
도와주세여 |