The simplest way to load a large object to a lob Field

Source: Internet
Author: User

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:/Documents and Settings/Hawk> sqlplus/nolog

SQL * Plus: Release 9.0.1.4.0-production on Tuesday July 18 15:08:15 2006

(C) Copyright 2001 Oracle Corporation. All rights reserved.

SQL> connect system/System
Connected.
SQL> Create Table testlob (ID number, thelob clob );

The table has been created.

SQL> Create or replace directory dir1 as 'd:/test /';

The directory has been created.

SQL> Create or replace procedure load_lob
2 l_clob clob;
3 l_bfile bfile;
4 begin
5 insert into testlob values (1, empty_clob ())
6 returning thelob into l_clob;
7
8 l_bfile: =bfilename('dir1', 'control.txt ');
9 dbms_lob.fileopen (l_bfile );
10
11 dbms_lob.loadfromfile (l_clob, l_bfile, dbms_lob.getlength (l_bfile ));
12 dbms_lob.fileclose (l_bfile );
13 end;
14/

The process has been created.

SQL> execute load_lob

The PL/SQL process is successfully completed.

SQL> select * From testlob;

Id thelob
----------------------------------------

1 rows? Too many? Why are there too many other users? Why? Too many? Slow failover? Too many? Dirty data? Jing Yu

SQL> commit;

Submitted.

SQL> select ID, dbms_lob.getlength (thelob) thelob from testlob;

Id thelob
--------------------
1 59

SQL>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.