Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Output to Excel
Ramon,
You need to add an alias to each of the cursors to declare the column OUT_REC. Like:
6 CURSOR C_FACTURAS IS
7 SELECT F.GRUPO||','|| 8 F.COMPANIA||','|| 9 F.TIPO_FACTURA||','|| 10 F.AGENCIA||','|| 11 F.FACTURA||','|| 12 F.CLIENTE||','|| 13 F.VENDEDOR||','|| 14 -- ZONA||','|| 15 F.DOCUMENTO_COBRO||','|| 16 F.FECHA||','|| 17 F.FECHA_PAGO||','|| 18 F.FECHA_VENCIMIENTO||','|| 19 F.ESTATUS_COMISION||','|| 20 F.COMISION_VENDEDOR||','|| 21 F.MONTO||','|| 22 F.MONTO_PAGADO||','|| 23 F.IMPRESA||',' OUT_REC <====== 24 -- ITBIS||','|| 25 -- DESCTO||',' 26 FROM FACTURAS F 27 WHERE 28 F.GRUPO = PGRUPO AND 29 F.COMPANIA = PCOMPANIA AND 30 F.AGENCIA = PAGENCIA AND 31 F.FECHA BETWEEN PFECHA_INICIAL AND PFECHA_FINAL;
Hope this helps
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
Sent: Friday, October 05, 2001 10:06 AM
To: Multiple recipients of list ORACLE-L
Thomas,
I keep getting the error
LINE/COL ERROR
-------- ----------------------------------------------------------------- 65/4 PL/SQL: Statement ignored 65/36 PLS-00302: component 'OUT_REC' must be declared 72/4 PL/SQL: Statement ignored
Gracias
Ramon Estevez
Dominican Republic
com.banilejas_at_codetel.net.do
1 CREATE OR REPLACE PACKAGE BODY PROCESAR_AGENCIAS AS 2 PROCEDURE GENERAR_FACTURAS
3 ( PGRUPO IN NUMBER, PCOMPANIA IN NUMBER, 4 PFECHA_INICIAL IN DATE, PFECHA_FINAL IN DATE, 5 PAGENCIA IN NUMBER ) AS 6 CURSOR C_FACTURAS IS 7 SELECT F.GRUPO||','|| 8 F.COMPANIA||','|| 9 F.TIPO_FACTURA||','|| 10 F.AGENCIA||','|| 11 F.FACTURA||','|| 12 F.CLIENTE||','|| 13 F.VENDEDOR||','|| 14 -- ZONA||','|| 15 F.DOCUMENTO_COBRO||','|| 16 F.FECHA||','|| 17 F.FECHA_PAGO||','|| 18 F.FECHA_VENCIMIENTO||','|| 19 F.ESTATUS_COMISION||','|| 20 F.COMISION_VENDEDOR||','|| 21 F.MONTO||','|| 22 F.MONTO_PAGADO||','|| 23 F.IMPRESA||',' 24 -- ITBIS||','|| 25 -- DESCTO||',' 26 FROM FACTURAS F 27 WHERE 28 F.GRUPO = PGRUPO AND 29 F.COMPANIA = PCOMPANIA AND 30 F.AGENCIA = PAGENCIA AND 31 F.FECHA BETWEEN PFECHA_INICIAL AND PFECHA_FINAL; 32 CURSOR C_ITEM_FACTURAS IS 33 SELECT I.GRUPO||','|| 34 I.COMPANIA||','|| 35 I.AGENCIA||','|| 36 I.TIPO_FACTURA||','|| 37 I.FACTURA||','|| 38 I.LOCALIDAD||','|| 39 I.ARTICULO||','|| 40 I.SECUENCIA||','|| 41 I.COSTO||','|| 42 I.PRECIO_VENTA||','|| 43 I.CANTIDAD||','|| 44 I.ITBIS||','|| 45 I.DESCTO||',' 46 FROM FACTURAS F, ITEM_FACTURAS I 47 WHERE 48 F.GRUPO = PGRUPO AND 49 F.COMPANIA = PCOMPANIA AND 50 F.AGENCIA = PAGENCIA AND 51 F.FECHA BETWEEN PFECHA_INICIAL AND 52 PFECHA_FINAL AND 53 I.GRUPO = F.GRUPO AND 54 I.COMPANIA = F.COMPANIA AND 55 I.TIPO_FACTURA = F.TIPO_FACTURA AND 56 I.FACTURA = F.FACTURA; 57 V_ARCHIVO UTL_FILE.FILE_TYPE; 58 REGISTRO FACTURAS%ROWTYPE; 59 OUT_REC REGISTRO%TYPE;60 BEGIN
62 V_ARCHIVO := UTL_FILE.FOPEN('D:\EMBARQUES','FACTURAS.TXT', 'W'); 63 FOR FT IN C_FACTURAS 64 LOOP 65 UTL_FILE.PUT_LINE(V_ARCHIVO, FT.OUT_REC); 66 END LOOP; 67 UTL_FILE.FCLOSE(V_ARCHIVO); 68 -- Loop para el archivo de Item Facturas 69 V_ARCHIVO := UTL_FILE.FOPEN('D:\EMBARQUES','ITEM_FACTURAS.TXT', 'W'); 70 FOR IFT IN C_ITEM_FACTURAS 71 LOOP 72 UTL_FILE.PUT_LINE(V_ARCHIVO, IFT.OUT_REC); 73 END LOOP; 74 UTL_FILE.FCLOSE(V_ARCHIVO);
SQL> SHOW ERRORS
Errors for PACKAGE BODY PROCESAR_AGENCIAS:
LINE/COL ERROR
-------- ----------------------------------------------------------------- 65/4 PL/SQL: Statement ignored 65/36 PLS-00302: component 'OUT_REC' must be declared 72/4 PL/SQL: Statement ignored
-----Mensaje original-----
De: root_at_fatcity.com [mailto:root_at_fatcity.com]En nombre de Thomas, Kevin
Enviado el: Friday, 05 October, 2001 4:15 AM
Para: Multiple recipients of list ORACLE-L
Asunto: RE: Output to Excel
I believe the error to be where you have:
OUT_REC TYPE REGISTRO; it should be: OUT_REC REGISTRO%TYPE;
Is there something missing ?
Any help !!
Thanks in Advance,
Ramon E. Estevez
com.banilejas_at_codetel.net.do
Dominican Republic
809-565-3121
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Ramon Estevez INET: com.banilejas_at_codetel.net.do Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri Oct 05 2001 - 10:13:58 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Thomas, Kevin INET: Kevin.Thomas_at_calanais.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Ramon Estevez INET: com.banilejas_at_codetel.net.do Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Mercadante, Thomas F INET: NDATFM_at_labor.state.ny.us Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).