⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo03.sql

📁 Expert Oracle Database Architecture 9i and 10g sql源码
💻 SQL
字号:
create or replace directory dir1   as '/tmp/';
create or replace directory "dir2" as '/tmp/';
create table demo
( id        int primary key,
  theClob   clob
)
/
host echo 'Hello World!' > /tmp/test.txt
declare
    l_clob    clob;
    l_bfile   bfile;
begin
    insert into demo values ( 1, empty_clob() )
     returning theclob into l_clob;

    l_bfile := bfilename( 'DIR1', 'test.txt' );
    dbms_lob.fileopen( l_bfile );

    dbms_lob.loadfromfile( l_clob, l_bfile,
                           dbms_lob.getlength( l_bfile ) );

    dbms_lob.fileclose( l_bfile );
end;
 /
select dbms_lob.getlength(theClob), theClob from demo
/
rollback;

declare
    l_clob    clob;
    l_bfile   bfile;
begin
    insert into demo values ( 1, empty_clob() )
     returning theclob into l_clob;

    l_bfile := bfilename( 'dir1', 'test.txt' );
    dbms_lob.fileopen( l_bfile );

    dbms_lob.loadfromfile( l_clob, l_bfile,
                           dbms_lob.getlength( l_bfile ) );

    dbms_lob.fileclose( l_bfile );
end;
/
declare
    l_clob    clob;
    l_bfile   bfile;
begin
    insert into demo values ( 1, empty_clob() )
     returning theclob into l_clob;

    l_bfile := bfilename( 'dir2', 'test.txt' );
    dbms_lob.fileopen( l_bfile );

    dbms_lob.loadfromfile( l_clob, l_bfile,
                           dbms_lob.getlength( l_bfile ) );

    dbms_lob.fileclose( l_bfile );
end;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -