尝试将一些结果输出到 Windows 文件夹“c:\temp”中。编译并运行我的程序没有任何问题,但我找不到我的输出文件“c:\temp\foo.log”。这是我的代码:
CREATE OR REPLACE DIRECTORY tmp AS 'c:\temp\';
CREATE OR REPLACE PROCEDURE write_log
AS
CURSOR cur
IS
SELECT firstname,
lastname
FROM MEMBER
WHERE memberid BETWEEN 2 AND 5; -- only test 3 rows.
fname MEMBER.firstname%TYPE;
lname MEMBER.lastname%TYPE;
outputrecord VARCHAR2 ( 255 );
outputfile UTL_FILE.file_type;
BEGIN
OPEN cur;
FETCH cur
INTO fname,
lname;
outputfile := UTL_FILE.fopen ( UPPER ( 'tmp' ),
'foo.log',
'W',
32767
);
WHILE cur%FOUND
LOOP
outputrecord := fname || ',' || lname;
UTL_FILE.put ( outputfile, outputrecord );
UTL_FILE.new_line ( outputfile );
FETCH cur
INTO fname,
lname;
END LOOP;
CLOSE cur;
UTL_FILE.fclose ( outputfile );
END write_log;
/
BEGIN
write_log;
END;
/
我在这里做错了吗?
谢谢!