Jeg har fundet følgende kode fra eksperten.dk, og har rettet en lille smule
i det, men jeg synes ikke det virker, hvad har jeg gjort galt ?
CREATE OR REPLACE PROCEDURE log IS
file_handle UTL_FILE.FILE_TYPE; -- file handle of OS flat file
col1 NUMBER; -- reservations_id retrieved from
reservation table
retrieved_buffer VARCHAR2(100); -- Line retrieved from flat file
BEGIN
-- Open file to write into and obtain its file_handle.
file_handle := UTL_FILE.FOPEN('/','myfile.txt','W');
-- Write a line of text out to the file.
UTL_FILE.PUT_LINE(file_handle, 'this is line 1 as a test');
-- Select the c1 from the testtab table where bruger_id = 'RK'.
SELECT reservations_id INTO col1 FROM reservation
WHERE bruger_id = 'RK';
-- Using PUTF write text with the col1 argument out to the file.
UTL_FILE.PUTF (file_handle, 'This is the c1 %s when the c2 is
%s.\n',
col1,'25');
-- Close the file.
UTL_FILE.FCLOSE(file_handle);
dbms_output.put_line(col1);
END;
SQL>execute log;
BEGIN log; END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'LOG'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
--Rune
|