Form Builder 代码汇编一:表单当前所有记录输出到CSV文件


declare

       dirnamevarchar2(300);

       s_filenamevarchar2(300);

       filternamevarchar2(50);

       titlenamevarchar2(50);

      

       begin

dirname:='D:\mepi_projects\temp';

filtername:='|csv file|*.csv|Allfiles|*.*|';

titlename:='文件另存为';

s_filename:=webutil_file.File_Save_Dialog(dirname,filtername,titlename);

 

if length(s_filename)>0 then

 

WRITE_ITEM_BLOCK(s_filename);

end if;

end;

 

 

PROCEDURE WRITE_ITEM_BLOCK(FILENAME INVARCHAR2) IS

       MYFILECLIENT_TEXT_IO.FILE_TYPE;

       CUR_RECNUMBER;

BEGIN

 GO_BLOCK('CONTRACTS');

 CUR_REC := :SYSTEM.CURSOR_RECORD;

  IF:SYSTEM.BLOCK_STATUS!='NEW' THEN

      FIRST_RECORD;

      MYFILE:=CLIENT_TEXT_IO.FOPEN(FILENAME,'W');

      CLIENT_TEXT_IO.PUTF(MYFILE,'编码,合同名称,投资方,合同额,到账率,状态,签订时间,结束时间'||CHR(10));

      LOOP

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CCODE)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CTITLE)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CINVESTOR)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CQUOTA)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CFUND)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CSTATE)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CSTART)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,TO_CHAR(:CONTRACTS.CEND)||',');

             CLIENT_TEXT_IO.PUTF(MYFILE,CHR(10));

             EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';

             NEXT_RECORD;

      END LOOP;

      CLIENT_TEXT_IO.FCLOSE(MYFILE);

  ENDIF;

 GO_RECORD(CUR_REC);

END;


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告