473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using clob

15
hi.
i want the code or reference for insert command using the CLOB datatype.
Mar 3 '08 #1
4 2495
debasisdas
8,127 Expert 4TB
Please find a related article here .
Mar 3 '08 #2
sinner
15
Please find a related article here .
thanks for the reference
Mar 3 '08 #3
hi.
i want the code or reference for insert command using the CLOB datatype.
Expand|Select|Wrap|Line Numbers
  1.  
  2. create table demo
  3.     ( id        int primary key,
  4.       theClob    clob
  5.     )
  6. /
  7.  
  8. create or replace directory my_files as 'C:\';
  9. /
  10.  
  11. CREATE OR REPLACE procedure load_a_file( p_id in number,
  12.                         p_filename in varchar2 )
  13.  as
  14.      l_clob    clob;
  15.      l_bfile    bfile;
  16.  begin
  17.      insert into demo values ( p_id, empty_clob() )
  18.      returning theClob into l_clob;
  19.      l_bfile := bfilename( 'MY_FILES', p_filename );
  20.      dbms_lob.fileopen( l_bfile );
  21.      dbms_lob.loadfromfile( l_clob, l_bfile,
  22.                             dbms_lob.getlength( l_bfile ) );
  23.      dbms_lob.fileclose( l_bfile );
  24.  end;
  25. /
  26.  
  27. EXECUTE load_a_file(2,'YY.TXT');
  28.  
  29.  
Mar 4 '08 #4
sinner
15
Expand|Select|Wrap|Line Numbers
  1.  
  2. create table demo
  3.     ( id        int primary key,
  4.       theClob    clob
  5.     )
  6. /
  7.  
  8. create or replace directory my_files as 'C:\';
  9. /
  10.  
  11. CREATE OR REPLACE procedure load_a_file( p_id in number,
  12.                         p_filename in varchar2 )
  13.  as
  14.      l_clob    clob;
  15.      l_bfile    bfile;
  16.  begin
  17.      insert into demo values ( p_id, empty_clob() )
  18.      returning theClob into l_clob;
  19.      l_bfile := bfilename( 'MY_FILES', p_filename );
  20.      dbms_lob.fileopen( l_bfile );
  21.      dbms_lob.loadfromfile( l_clob, l_bfile,
  22.                             dbms_lob.getlength( l_bfile ) );
  23.      dbms_lob.fileclose( l_bfile );
  24.  end;
  25. /
  26.  
  27. EXECUTE load_a_file(2,'YY.TXT');
  28.  
  29.  
thanks for the code
regards
Mar 5 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: freak | last post by:
hi i have problems reading an oracle(9i) clob from a php-script with the MDB-class from pear. the table files has 3 fields: id integer document clob picture clob
1
by: Chris | last post by:
I use websphere connection pooling and had a failure attempting a CLOB.createTemporary. tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); Here's an excerpt of the exception...
5
by: gimme_this_gimme_that | last post by:
In Oracle you can have a statement such as insert into foo (foo_id,some_clob) values (100,empty_clob()) where empty_clob() inserts a clob address. What is the approach in DB2 (8.1) to...
8
by: ignatova | last post by:
Hello, I have been using IBM Net Search Extender to perform full text searches on text columns in relational tables in DB2 without any problems until now. However it doesn't seam to function...
3
by: gupta.harika | last post by:
Hi everyone, I am a developer working on php with oracle as backend. I am facing a problem related with the CLOB data. The problem is as follows My application uses a table which contains Clob...
1
by: msc.batra | last post by:
I want to load multiple rows of BLOB and CLOB into DB2 using CLI. Which are the possible ways to do it? Any help...
8
by: gimme_this_gimme_that | last post by:
I have the following Java code : package com.rhi.bb.udf.utils; import java.sql.Clob; import java.sql.SQLException; import java.util.regex.Pattern; import java.util.regex.Matcher;
1
by: Cerebrus | last post by:
Hi all, Using : .NET 1.1, SQL Server 2000, Win 2K. Could anyone confirm if there is a bug in the SqlDataReader.GetChars() method when using CommandBehavior.SequentialAccess to get a BLOB...
0
by: *Davide* | last post by:
Hello, This query (PHP+Oracle) works: global $user,$pass,$sid; $db_charset = 'UTF8'; $db = OCILogon($user, $pass, $sid, $db_charset); $clob = OCINewDescriptor($db, OCI_D_LOB); $txt_clob =...
1
by: Veeru71 | last post by:
When I am SELECT'ing a CLOB column from command prompt, the output is getting truncated after a certail limit (8 K ??) How do I get the full data out of a CLOB column? Are there any string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.