CREATE OR REPLACE FUNCTION eca_process() RETURNS void AS $BODY$ DECLARE nP NUMERIC:=0; nL NUMERIC:=0; i NUMERIC:=0; j NUMERIC:=0; orderId CHARACTER VARYING(32); orderlineId CHARACTER VARYING(32); BEGIN while (nP < 300) LOOP select * into orderId from get_uuid(); INSERT INTO c_order values (orderId,'1000000','1000002','Y',now(),'100',now(),'100','Y',to_char(90000+nP),'DR','CO','N','N','0','1000026',null,'N','N','N','N',null,now(),now(),null,now(),'1000008','1000004','1000004',null,'N','102','5','1000000','I','R','I',0.00,'D',null,null,0.00,'5',0.00,0.00,'1000000','1000003','N',null,null,null,'N','1000007','N',null,null,null,'N',null,null,null,null,null,null,'N',null,'N'); while nL < 5 LOOP select * into orderlineId from get_uuid(); insert into c_orderline values (orderlineId,'1000000','1000002','Y',now(),'100',now(),'100',orderId,10+nL,'1000008','1000004','2010-05-14 00:00:00','2010-05-14 00:00:00',null,null,null,'1000005','1000000','N','100',1,0,0,0,null,'102',42.00,37.80,36,37.80,10.00,0.00,null,0.00,'1000000',null,null,null,'N',null,null,null,37.80,'N',null,'N',37.80); nL:= nL+1; END LOOP; nL := 0; perform c_order_post1(null, orderId); nP:= nP+1; END LOOP; -- RETURN; END ; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION eca_process() OWNER TO tad;