yes! i restart the sever which contain the database! and it is normal!! thank you!
给你一个例子吧: create or replace procedure test as f UTL_FILE.file_type; s varchar2(200); a varchar2(200); path varchar2(50); begin path:='c:'; f:=utl_file.fopen('c:','aa.CSV','R'); loop utl_file.get_line(f,s); N:=INSTR(S,',',1,1); a := substr(s,.....) select count(*) into i from aa where aa = a; if i > 0 then update .... set ... else insert into ..... end if; end loop; utl_file.fclose(f); COMMIT; EXCEPTION when NO_DATA_FOUND then utl_file.fclose(f); rollback; end; /
记住要在initsid.ora里面配置utl_file_dir=允许开放读写权限的目录。
可以不用在init.ora中改的 只要用管理员的权限登陆,执行: create directory UTL_FILE_TEST as '\*' 应该就可以了,不用新启动oracle的 不过其他用户要使用此目录要授权的
thank you!
create or replace procedure test as
f UTL_FILE.file_type;
s varchar2(200);
a varchar2(200);
path varchar2(50);
begin
path:='c:';
f:=utl_file.fopen('c:','aa.CSV','R');
loop
utl_file.get_line(f,s);
N:=INSTR(S,',',1,1);
a := substr(s,.....)
select count(*) into i from aa where aa = a;
if i > 0 then
update .... set ...
else
insert into .....
end if;
end loop;
utl_file.fclose(f);
COMMIT;
EXCEPTION
when NO_DATA_FOUND then
utl_file.fclose(f);
rollback;
end;
/
只要用管理员的权限登陆,执行:
create directory UTL_FILE_TEST as '\*'
应该就可以了,不用新启动oracle的
不过其他用户要使用此目录要授权的