blob / clob type of data access methods

2011-03-14  来源:本站原创  分类:Database  人气:80 

CREATE OR REPLACE PROCEDURE TEST_BLOB IS
lv_photo BLOB;
lv_file BFILE;
lv_length INT;
src_offset INT: = 1;
dest_offset INT: = 1;
lv_buffer RAW (2000);
lv_newfile utl_file.file_type;
BEGIN
- Write photo
DELETE FROM fac.test_blob;
COMMIT;
INSERT INTO fac.test_blob VALUES ('AAA', empty_blob ());
COMMIT;
- Lock record
SELECT photo INTO lv_photo FROM fac.test_blob FOR UPDATE;
- Get file
lv_file: = bfilename ('FAC_INBOUND_CC', 'Blue hills.jpg');
- Open file
dbms_lob.fileopen (lv_file, 0);
- Get file length
lv_length: = dbms_lob.getlength (lv_file);
- Write file to table
dbms_lob.loadblobfromfile (lv_photo,
lv_file,
lv_length,
dest_offset,
src_offset);
dbms_lob.fileclose (lv_file);
COMMIT;
- Read photo
- Get field
SELECT photo INTO lv_photo FROM fac.test_blob;
- Read 2000 byte in every loop
lv_length: = 2000;
- Create new file
- Utl_file.fremove ('FAC_OUTBOUND', 'TEST_BLOB1.jpg');
lv_newfile: = utl_file.fopen ('FAC_OUTBOUND',
'TEST_BLOB' | |
TO_CHAR (SYSDATE, 'YYYYMMDDHH24MISS') | | '. Jpg',
'W',
32767);
LOOP

BEGIN
- Read data
dbms_lob.READ (lv_photo, lv_length, src_offset, lv_buffer);

- Write to file
utl_file.put_raw (lv_newfile, lv_buffer);

- Start position
src_offset: = src_offset + 2000;
EXCEPTION
WHEN no_data_found THEN
EXIT;
END;

END LOOP;
utl_file.fclose (lv_newfile);
END;

相关文章
  • blob / clob type of data access methods 2011-03-14

    CREATE OR REPLACE PROCEDURE TEST_BLOB IS lv_photo BLOB; lv_file BFILE; lv_length INT; src_offset INT: = 1; dest_offset INT: = 1; lv_buffer RAW (2000); lv_newfile utl_file.file_type; BEGIN - Write photo DELETE FROM fac.test_blob; COMMIT; INSERT INTO f

  • Hibernate Implementation Oracle Blob / Clob types of data read and write 2010-05-10

    Environment: Eclipse3.1 + Hibernate2 + Oracle 10g Description: The case of the use of Eclipse3.1 through a Java project to achieve the Oracle in the Blob / Clob types of data reading and writing. 1. In the oracle database, create a table named: BIGDA

  • JAVA complete control instructions in Oracle BLOB.CLOB 2011-03-30

    Transfer http://blog.csdn.net/yeliang0202/archive/2007/12/11/1928510.aspx <Type = "text / javascript"> function StorePage () {d = document; t = d.selection? (D.selection.type! = 'None'? D.selection.createRange (). Text :''): (d.getSelectio

  • ArcGIS Engine in Data Access 2010-03-19

    GIS data is the foundation of any access to data is a complex spatial analysis and spatial visualization premise. ArcGIS supports rich data formats, different data formats on the level of support is also very different. This paper introduce the follo

  • (Transfer) AS3 data access mode Efficiency 2011-01-14

    AS3 Tutorials (13): AS3 in the Efficiency of data access methods December 1, 2008 Monday 16:33 Today there is another friend and I chatted on MSN AS3 efficient access to data in the topic, suddenly remembered previous forum in blueidea discussed . St

  • spring2 the way through jdbc to read. update the database clob or blob type of data 2010-02-05

    Today, due to the need for the project must be spring the way through jdbc to read and update the clob types of data, just the beginning, I get a data connection directly through the spring and then use the PreparedStatement handle, but the result wa

  • operation of large object type oracle: blob, clob, nclob, bfile 2011-03-14

    3-4 Lob type 13.4.1 Basic Introduction Oracle and plsql support lob (large object) type, used to store large amounts of data such as image files, sound files, etc. Oracle 9i realse2 support a maximum of 4g of data storage, oracle 10g realse1 support

  • MySQL JDBC to read and write the BLOB and CLOB types of data (examples) 2010-06-02

    JDBC Read and write to LOB In the JDBC provides java.sql.Blob And java.sql.clob two classes which represent BLOB And CLOB data • BLOB(Binary Large Object): Used to store large amounts of binary data • CLOB(Character Large Object): Used to store a lar

  • MySQL JDBC to read and write BLOB and CLOB types of data (with code) 2010-06-04

    JDBC Read and write to LOB In the JDBC provides java.sql.Blob And java.sql.clob two classes which represent BLOB And CLOB data • BLOB(Binary Large Object): Used to store large amounts of binary data • CLOB(Character Large Object): Used to store a lar

  • Oracle data types in BLOB.CLOB.LONG.LongRaw difference (to) 2011-01-13

    LONG: variable-length string of data, up to 2G, LONG has the characteristics of VARCHAR2 columns, you can store a maximum length of text in a table column of a LONG LONG RAW: variable-length binary data, up to 2G CLOB: used to store single-byte chara

  • Blob and Clob types of data manipulation (1) 2010-04-25

    Blob and Clob types of data manipulation (1) http://book.51cto.com/art/201001/179042.htm Section 11.1.3 of this chapter describes a string of binary large objects and large object mapping. In the persistent class, a binary large object can be declare

  • tomcat6.0 configuration steps and MYSQL data source access methods 2010-09-14

    tomcat6.0 configuration steps and MYSQL data source access methods 2008-09-25 14:42 Reference article: 1. http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 2. http://blog.sina.com.cn/s/blog_4ce7bff90100a13r.html tomcat6.0 co

  • operation of large object type oracle: blob, clob, nclob, bfile difference 2011-03-07

    LOB (large object) types of variables are as follows: Type Description BFILE binary file, stored in a database outside of the operating system files, read-only. Put this file as a binary process. BLOB binary large object. Stored in the database of a

  • oracle in the large object data types and significance of the difference blob.clob.nclob 2011-10-26

    ORIGINAL http://blog.csdn.net/yoyo_yaya/article/details/1494944 These days have been trying to do a project with the Oracle database into a database with msSql2000, I thought as long as the database connection pool to change to change on it, did not

  • oracle blob data access 2010-06-16

    Oracle's lob (Large Object) can store very large of data (probably yes 4GB), so you can File or by any other object sequence into bytes Output stream (OutputStream) after the written to the database Zhihoushiyong bytes Shuru stream (InputStream) to r

  • JDBC review, oracle of the blob, clob read and write 2010-08-04

    JDBC Review JDBC driver type: JDBC-ODBC bridge; part of the local API, part of the JAVA driver; JDBC network pure JAVA driver; local protocol pure JAVA driver. The last one is the most efficient access to the database. This is currently the most wide

  • Java data type, Hibernate data types, standard sql data type correspondence table between 2010-05-13

    Hibernate API Introduction Its interface is divided into the following categories: l provide access to the database operation interface; l used to configure the Hibernate interfaces; l callback interfaces l extend Hibernate functionality of the inter

  • About Oracle's BLOB.CLOB field operation (sub-JDBC and Hibernate two) last update ... 2011-02-22

    Note: This article uses JDK1.6 and Oracle ojdbc6 driven, based on ORALCE 9I database, ojdbc6 corresponding jdk1.6, some functions if this method is not available elsewhere or in some inexplicable error, it is mostly because the driver reasons. . . Th

  • Ten Steps to optimize SQL Server Data Access 2011-08-24

    The story begins: You and your team through unremitting efforts, and finally make the site successful on-line, at the beginning, fewer registered users, site performance is good, but with the increase in registered users, access speeds began to slow,

  • Data Access Objects DAO 2009-07-28

    Data Access Objects (Data Access Model - DAO) Requirements: A year ago, the staff requested information saved to the XML document, One year later, the customer also saved to the database. Analysis: 1. When the demand for more functional changes, we c