UNIX Oracle 10g can use UTL

Source: Internet
Author: User
Tags insert rollback
oracle|unix| Data can unix Oracle 10g read file data with Utl_file packets?
I am under Window Oracle 8i using Utl_file can read the data of text files, I test through,
But not on Unix Oracle 10g! Error!
Begin Loadfiledata (' D:\ora ', ' 1.txt '); End

ORA-29280: Invalid directory path
ORA-06512: In the SYS. Utl_file ", line 33
ORA-06512: In the SYS. Utl_file ", line 436
ORA-06512: In "Wty." Loadfiledata ", line 20
ORA-06512: On line 1
=====================
My stored procedure is loadfiledata:
Create or Replace procedure Loadfiledata (P_path varchar2,p_filename varchar2) is

V_filehandle Utl_file.file_type; --Define a file handle
V_text varchar2 (100); --Storing text
V_name Test.name%type;
V_ID Test.autoid%type;
V_firstlocation number;
V_secondlocation number;
v_totalinserted number;
Begin
if (P_path is null or p_filename is null) then
Goto To_end;
End If;
v_totalinserted:=0;
/*open specified file*/
V_filehandle:=utl_file.fopen (P_path,p_filename, ' R '); ----Open the file and read the data
Loop
Begin
Utl_file.get_line (V_filehandle,v_text);
exception
When No_data_found Then
Exit
End;
V_firstlocation:=instr (V_text, ', ', 1,1);---text file the first ', ' position
V_id:=substr (v_text,1,v_firstlocation-1);---intercept the text file before the first ', ' before the string.
V_name:=substr (v_text,v_firstlocation+1);
/* Insert Database Operation * *
Begin
INSERT INTO Test
Values (v_id,v_name);
If Sql%rowcount=0 Then
Rollback
Else
Commit
End If;
exception
When others then
Rollback
End
End Loop;
<<to_end>>
Utl_file.fclose (V_filehandle);
Null

End Loadfiledata;
===========
The Loadfiledata stored procedure works fine in window Oralce 8I, but why not on Unix ORACLE 1OG
is not a change in the UNIX ORACLE 1OG utl_file package!
Everybody help!
My personal website http://www.kao99.com


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.