despues deseo recorrer el cursor fila por fila e insertar cada fila en una tabla Layers pero no me funciona ell codigo q les dejo abajo.... que esta mal??
Gracias de antemano
Código:
CREATE OR REPLACE FUNCTION sp_test() RETURNS VOID AS $BODY$ DECLARE or_nbr varchar(36) ; symb varchar(16); or_action varchar(2); shar int; price numeric(13,6); st char(1); event_tim varchar(30); tra_id varchar(16); market varchar(10); cursX CURSOR FOR SELECT * FROM Temp_orders WHERE state='F'; BEGIN OPEN cursX ; Loop FETCH cursX INTO or_nbr,symb,or_action,shar, price, st, event_tim, tra_id, market; INSERT INTO Layers(order_nbr,symbol,orden_action, shares,order_price,state ,event_time, trader_id, market_id) VALUES (or_nbr,symb,or_action,shar, price, st, event_tim, tra_id, market) ; END LOOP; CLOSE cursX; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION sp_test() OWNER TO postgres; SELECT * FROM sp_test();