fileid是从表里读出的还是自动生成的?
帮你顶顶吧。

解决方案 »

  1.   

    建立sequence 用来自动生成fileid
    create sequence SQU
    minvalue 1
    maxvalue 9999999999
    start with 1
    increment by 1
    cache 20
    order
    插入数据
    create or replace procedure aaa
    is
    num number:=1;
    fileid number;
    begin
    select squ.nextval into fileid from dual;
    循环读文件
    if num=1 then
     
      insert into file(fileid,filename);
     num:=2
    end if
    insert into username(fileid,username);
    循环结束
    end aaa;
      

  2.   

    读文件
    v_fh utl_file.file_type;
    v_newline varchar2(450);
    begin
    v_fh:=utl_file.fopen('e:\cwgz',v_newline,'r');
    loop 
    begin
    utl_file.get_line(v_fh,v_newline);
    v_hs:=v_hs+1;
    exception
    when no_data_found then
    exit;
    end;
    end loop; 
    utl_file.fclose(v_fh);
    end;