This discussion is archived
1 Reply Latest reply: Apr 17, 2013 10:47 PM by Marwim RSS

Generate txt file with UTL_FILE

1003087 Newbie
Currently Being Moderated
Hello,

I wonder how I can generate a txt file in the c:\crm called bloco.txt using UTL_FILE command.
Following query to be generated in txt:

SELECT *
FROM (SELECT EST.EST_IN_CODIGO,
BL.EMP_EST_IN_CODIGO,
EST.EST_ST_NOME,
EST.CUS_IN_REDUZIDO,
EST.CUSE_IN_REDUZIDO,
EST.PRO_IN_REDUZIDO,
EST.EST_DT_LANCAMENTO,
BL.BLO_IN_NUMUNIDADES,
BL.BLO_IN_NUMANDARES,
ENT.ENT_DT_ENTREGA,
EST.EST_DT_HABITE,
ROW_NUMBER () OVER (PARTITION BY BL.EST_IN_CODIGO ORDER BY ENT.ENT_DT_CADASTRO DESC) rnk
FROM MGDBM.DBM_ESTRUTURA EST,
MGDBM.DBM_BLOCO BL,
MGDBM.DBM_ENTREGA_OBRA ENT
WHERE EST.EST_CH_TIPOESTRUTURA = 'B'
AND EST.ORG_TAB_IN_CODIGO = BL.ORG_TAB_IN_CODIGO
AND EST.ORG_PAD_IN_CODIGO = BL.ORG_PAD_IN_CODIGO
AND EST.ORG_IN_CODIGO = BL.ORG_IN_CODIGO
AND EST.ORG_TAU_ST_CODIGO = BL.ORG_TAU_ST_CODIGO
AND EST.EST_IN_CODIGO = BL.EST_IN_CODIGO
AND EST.ORG_TAB_IN_CODIGO = ENT.ORG_TAB_IN_CODIGO
AND EST.ORG_PAD_IN_CODIGO = ENT.ORG_PAD_IN_CODIGO
AND EST.ORG_IN_CODIGO = ENT.ORG_IN_CODIGO
AND EST.ORG_TAU_ST_CODIGO = ENT.ORG_TAU_ST_CODIGO
AND EST.EST_IN_CODIGO = ENT.EST_IN_CODIGO AND
          EST.FIL_IN_CODIGO not between 36 and 37 AND
EST.fil_in_codigo not between 106 and 197 AND
EST.fil_in_codigo not between 320 and 323 AND
EST.fil_in_codigo not between 326 and 330 AND
EST.fil_in_codigo not between 372 and 373 AND
EST.fil_in_codigo not between 378 and 379 AND
EST.fil_in_codigo not between 202 and 210 AND
EST.fil_in_codigo not between 211 and 212 AND
EST.fil_in_codigo not between 213 and 228 AND
EST.fil_in_codigo not between 231 and 246 AND
EST.fil_in_codigo not between 247 and 259 AND
EST.fil_in_codigo not between 331 and 332 AND
EST.fil_in_codigo not between 349 and 356 AND
EST.fil_in_codigo not between 372 and 373 AND
EST.fil_in_codigo not between 378 and 379 AND
EST.fil_in_codigo not between 392 and 399 AND
EST.fil_in_codigo not between 406 and 409 AND
EST.fil_in_codigo not between 414 and 444 AND
EST.fil_in_codigo not between 457 and 458 AND
EST.fil_in_codigo not between 596 and 599 AND
EST.fil_in_codigo not between 4862 and 4862)
WHERE rnk = 1;

Thank you.
  • 1. Re: Generate txt file with UTL_FILE
    Marwim Expert
    Currently Being Moderated
    Hello,

    this is the forum for {forum:id=260}.

    Your question should be asked in {forum:id=75}. So please mark this question as answered and post again there.

    When you post, then include more information:
    * Database version
    * Do you want to create the file on the server or on the client PC?

    You also might want to read {message:id=10970106} before posting.

    Regards
    Marcus

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points