zoukankan      html  css  js  c++  java
  • WORD 测试

    --载入图片到数据库

    declare

    alob blob;
    afile bfile;
    amount int;
    src_offset int := 1;
    dest_offset int := 1;
    begin
    select photo into alob from photo_tab for update;
    afile := bfilename('G', 'a.jpg');
    dbms_lob.fileopen(afile, 0);
    amount := dbms_lob.getlength(afile);
    dbms_lob.loadblobfromfile(alob, afile, amount, dest_offset, src_offset);
    dbms_lob.fileclose(afile);
    commit;
    end;
    /

     

    --从数据库读取图片到文件.

    declare
    alob blob;
    amount int;
    offset int := 1;
    totalw int := 0;
    currentw int;
    buffer raw(2000);
    f utl_file.file_type;
    begin
    select photo into alob from photo_tab ;
    amount := dbms_lob.getlength(alob);
    f := utl_file.fopen('G', 'b.jpg', 'ab', 2000);
    loop
    if ((amount - totalw) >= 2000) then
    currentw := 2000;
    else
    currentw := amount - totalw;
    end if;
    dbms_lob.read(alob, currentw, totalw + 1, buffer);
    utl_file.put_raw(f, buffer);
    totalw := totalw + currentw;
    exit when totalw = amount;
    end loop;
    utl_file.fclose(f);
    end;
    /

  • 相关阅读:
    validate BST
    LC282. Expression Add Operators
    nginx统计日志命令
    iptables和firewalld命令
    nginx安装
    测试服务器IO
    规范主机名和设置最大文件进程数
    Docker安装
    MySQL/MariaDB二进制安装
    Docker原理
  • 原文地址:https://www.cnblogs.com/qqjue/p/2612265.html
Copyright © 2011-2022 走看看