drop procedure if exists fixDMSDeclarations//
create procedure fixDMSDeclarations()
DETERMINISTIC
begin
declare done int default 0;
declare shipmentOID varchar(40);
declare backupShipmentOID varchar(40);
declare itemOID varchar(40);
DECLARE itemCounter INT DEFAULT 0;
declare dmsShipmentCursor cursor for
SELECT OID
FROM cus_nl_dms_cusdec_good_shp
WHERE
`DMS_CUSDEC_GOOD_SHIP_OID` IS NULL
AND dms_cusdec_good_ship_oid_b IS NOT NULL
AND dms_cusdec_good_ship_oid_b IN (SELECT oid FROM cus_nl_dms_cusdec);
declare dmsItemCursor cursor for
SELECT OID, gov_agncy_gdsitm_oid_b
FROM cus_nl_dms_gvagncy_gds_itm
WHERE
GOV_AGNCY_GDSITM_OID IS NULL
AND GOV_AGNCY_GDSITM_INDEX IS NULL
AND gov_agncy_gdsitm_oid_b IS NOT NULL
AND gov_agncy_gdsitm_oid_b IN (SELECT oid FROM cus_nl_dms_cusdec_good_shp)
ORDER BY gov_agncy_gdsitm_oid_b;
declare continue handler for not found set done = 1;
OPEN dmsShipmentCursor;
dmsShipmentLoop: loop
fetch next from dmsShipmentCursor into shipmentOID;
if done = 1 then
leave dmsShipmentLoop;
end if;
Error on: OPEN dmsShipmentCursor;
sql looks like:
drop procedure if exists fixDMSDeclarations// create procedure fixDMSDeclarations() DETERMINISTIC begin declare done int default 0; declare shipmentOID varchar(40); declare backupShipmentOID varchar(40); declare itemOID varchar(40); DECLARE itemCounter INT DEFAULT 0;