We are doing a job for the university for the subject Databases
One of the sections asks us to create a PROCEDURE with cursors
We do not have much idea but we have tried to do it.
We have 3 tables: exit, company_transport, seed with these attributes Output: SID, LOT (FK), DATE, DESTINATION, NAME1 (FK), PRICE Company_transport: CIF1, NAME1, AREA, QUANTITY. Seed: TYPE, VARIETY, TREATMENT, WEIGHT, LOT.
The idea is that given the name of the company_transport we return a table with SID, TYPE, DESTINATION, DATE.
This has been what we have done but it gives us error
CREATE OR REPLACE PROCEDURE SEMILLAPOREMPRESA
(W_NOMBRE1 IN EMPRESA_TTE.NOMBRE1%TYPE) IS
BEGIN
DECLARE
CURSOR CUR IS
SELECT NOMBRE1, S.SID, TIPO, DESTINO, FECHA
FROM (SALIDA S INNER JOIN EMPRESA_TTE ET ON S.NOMBRE1=ET.NOMBRE1
INNER JOIN SEMILLA SE ON SE.LOTE=S.LOTE);
BEGIN
FOR FILA IN CUR LOOP
DBMS_OUTPUT.PUT_LINE(FILA.SID||''||FILA.TIPO||''||FILA.DESTINO||''||FILA.FECHA);
END LOOP;
END;
END SEMILLAPOREMPRESA;
/