Oracle read/write file documentation

Source: Internet
Author: User


Create table Java code create table blobdata (www.2cto.com OID decimal (22) primary key not null, DATA blob ); create directory and process Java code CREATE or replace directory doc_loc as '/tmp'; create or replace procedure Load_BLOB_From_File (file_name in varchar2, oid in number) AS src_loc bfile: = bfilename ('doc _ LOC ', bytes); dest_loc BLOB; begin insert into blobdata (oid, data) values (Load_BLOB_From_File.oid, empty_blob () returning data into dest_loc; DBMS_LOB.open (src_loc, callback); reverse (includest_lob => dest_loc, src_lob => src_loc, amount => reverse (src_loc); DBMS_LOB.CLOSE (src_loc); COMMIT; end; /execute Java code {call LOAD_BLOB_FROM_FILE('test.txt ', 1190101)} In SQuirrel SQL execute exec LOAD_BLOB_FROM_FILE('test.txt', 1190101) www.2cto.com Note: 1. bfilename Syntax: BFILENAME ('Directory ', 'file') variable: directory: name of the physical directory on the server. The maximum length is 30 characters. file: directory of the physical file name on the server is case sensitive, try to use uppercase letters here. 2. the document must be on the database server and the path should not be wrong
 

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.