Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Output to Excel

RE: Output to Excel

From: Thomas, Kevin <Kevin.Thomas_at_calanais.com>
Date: Fri, 05 Oct 2001 08:42:39 -0700
Message-ID: <F001.003A3769.20011005081520@fatcity.com>

Ramon,

I would add an alias onto the columns you are referencing in your cursors so that they are called something like DATA. This way when you come to reference FT later on you can use FT.DATA as the item to ouput to your file.

You appear to be referencing OUT_REC at line 65 incorrectly. OUT_REC is a record containing items of data. As you have opened the cursor on line 63 with the statement FOR FT IN C_FACTURAS, you have now assigned all the values that will be returned from the cursors into FT. In order to output the details that are now held within FT, line 65 should read something like:

UTL_FILE.PUT_LINE(V_ARCHIVO, FT.DATA);
You really don't need OUT_REC anymore as you never move data into it.

I hope this makes sense, I'm never very good at explaining things... ;o)

Regards,
Kev.


Kevin Thomas
Technical Analyst
Deregulation Services
Calanais Ltd.
(2nd Floor East - Weirs Building)

Tel: 0141 568 2377
Fax: 0141 568 2366
http://www.calanais.com

-----Original Message-----
Sent: 05 October 2001 15:06
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

72/37 PLS-00302: component 'OUT_REC' must be declared SQL> Any suggestion,

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
 61 -- Loop para el archivo de Facturas
 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);

 75 END GENERAR_FACTURAS;
 76* END PROCESAR_AGENCIAS;
SQL> / Warning: Package Body created with compilation errors.

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

72/37 PLS-00302: component 'OUT_REC' must be declared SQL> Ramon E. Estevez
com.banilejas_at_codetel.net.do <mailto:com.banilejas_at_codetel.net.do> 809-565-3121

-----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-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: 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: 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).
Received on Fri Oct 05 2001 - 10:42:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US