Olá,
Faltou aspas simples…
Create or Replace procedure GERATXT as
file_handle utl_file.file_type;
CURSOR CUR_TESTE is
select CAMPO_1, CAMPO_2, CAMPO_4
from MSIGA.TESTE;
reg_teste CUR_TESTE%ROWTYPE;
wlinha varchar2(120);
wnreg number := 0;
BEGIN
file_handle := UTL_FILE.FOPEN ('/logs/diretorios/utl_teste', 'teste.txt', 'w');
OPEN CUR_TESTE;
loop
fetch CUR_TESTE into reg_teste;
exit when CUR_TESTE%NOTFOUND;
wlinha := reg_teste.campo_1 || ';' || reg_teste.campo_2;
wlinha := wlinha || ';' || reg_teste.campo_4;
utl_file.put_line(file_handle,wlinha);
wnreg := wnreg + 1;
end loop;
UTL_FILE.FCLOSE(file_handle);
close CUR_TESTE;
dbms_output.put_line ('Num. registros gravados =' || to_char(wnreg));
end;
[]s Ishii