I have seen many posts on this, but none of the suggestions work. I have tried many variations of the following and I get pretty much the same error just on different lines. See below for the error.
My code is as follows:
CREATE OR REPLACE DIRECTORY LOAD_SRC AS 'C:\Stuff\BulkInsert';
--select * from all_directories where directory_name = 'LOAD_SRC'; C:\Stuff\BulkInsert is in the list
DECLARE
sale_amount NUMBER;
LOAD_SRC VARCHAR2(50); --If I don't add this I get the following msg: PLS-00201: identifier 'LOAD_SRC' must be declared
FILE_HANDLE utl_file.file_type;
BEGIN
FILE_HANDLE := utl_file.fopen(LOAD_SRC,'stuff.dat','W',256);--29280. 00000 - "invalid directory path"
SELECT sum(sale_amount) INTO sale_amount FROM POS_RECORD;-- where sale_amount like '%-%';
utl_file.put_line(FILE_HANDLE,sale_amount);
utl_file.fclose(FILE_HANDLE);
END;
/
@@@@@@@@@@@@@@@@@@@@@@@
Error:
CREATE OR REPLACE DIRECTORY succeeded.
Error starting at line 3 in command:
DECLARE
sale_amount NUMBER;
LOAD_SRC VARCHAR2(50); --If I don't add this I get the following msg: PLS-00201: identifier 'LOAD_SRC' must be declared
FILE_HANDLE utl_file.file_type;
BEGIN
FILE_HANDLE := utl_file.fopen(LOAD_SRC,'stuff.dat','W',256);--29280. 00000 - "invalid directory path"
SELECT sum(sale_amount) INTO sale_amount FROM POS_RECORD;-- where sale_amount like '%-%';
utl_file.put_line(FILE_HANDLE,sale_amount);
utl_file.fclose(FILE_HANDLE);
END;
Error report:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 478
ORA-06512: at line 6
29280. 00000 - "invalid directory path"
*Cause: A corresponding directory object does not exist.
*Action: Correct the directory object parameter, or create a corresponding
directory object with the CREATE DIRECTORY command.