Solved

Display CLOB in web page

Posted on 2011-02-12
12
1,406 Views
Last Modified: 2012-05-11
Hi Experts,

We have a web page where in we display the records from table (one of cloumn is clob) using Oracle query

One of the particular record length is 73244 and its throwing exception
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 73244, maximum: 4000)

We do not wish to truncate to 4000 characters using DBMS_LOB.SUBSTR function.

Is there any way to display the entire contents in SQL ? ( I cannot use PL/SQL as is web page query)

Thanks





0
Comment
Question by:ajexpert
12 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34880545
What web language and what data provider are you using?
0
 
LVL 14

Author Comment

by:ajexpert
ID: 34880861
When I execute the query in toad I get the error as I posted. Can u please help me how to convert clob column

there is no problem with data provider or web page. My goal is to modify query in suchh a way that I shouldn't get any error while executing from toad
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34880996
Toad should handle CLOBs without a problem.  What is the query?  Are you trying to concatenate a clob with another string?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 14

Author Comment

by:ajexpert
ID: 34881137
No I am not trying to concatenate with other string

yes toad can handle clobs but I m not able to see data, so we use TO_CHAR funtion. Since the data is more than 4000 characters it is throwing error as I stated above
0
 

Expert Comment

by:Suriyaraj_Sudalaiappan
ID: 34881763
Plz try to convert by use of TO_CLOB function
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 400 total points
ID: 34883419
You can only use to_clob when inserting a long into a new table.

As you already know, you cannot use to_char on a clob this way is it is larger than 4000 character.

You have me confused.  To can or cannot select the native clob in toad?  I assume that you can and the problem is with native clobs with the web page.

If this is correct, I need to know the web language and data provider.

0
 
LVL 5

Assisted Solution

by:Sanjeev Labh
Sanjeev Labh earned 100 total points
ID: 34884038
Hi I am also a little perplexed here since as far as I know toad can easily handle and display any clob coloumn being selected in a query.
e.g.

select my_clob from my_tab

toad returns the column data in the result row you would find an ellipse (...) symbol. Once you click it the whole text window opens with the clob data. So, it is really quite simple in toad. I am not sure if you are doing the same or I have got your question wrongly.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34884533
sanjeevlabh,

The issue was with using to_char on the clob from toad and the web code.  That is what generates the error.

We need to know what the web app was developed with so we can get that code to handle native clobs without trying to convert it to a string.

0
 
LVL 3

Expert Comment

by:dbauermann
ID: 34886925
ajexpert,

If you are using owa packages, I suggest the following code:

(...)
v_image   blob;
v_buffer   RAW(32767);
v_offset   BINARY_INTEGER := 1;
v_buffer_size   NUMBER := 32767;
(...)
OWA_UTIL.MIME_HEADER('image/gif');
 -- read the LOB content in a loop and send it across to the browser
LOOP
   DBMS_LOB.READ(v_image, v_buffer_size, v_offset, v_buffer);
   -- convert the raw content read into varchar2 and send it to the browser
   htp.prn(UTL_RAW.CAST_TO_VARCHAR2(v_buffer));
   v_offset:= (v_offset + v_tamanho_buffer);
END LOOP;
(...)

Open in new window

0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34887592
>>If you are using owa packages, I suggest the following code:

That code is for a BLOB. not a CLOB.

0
 
LVL 14

Author Comment

by:ajexpert
ID: 34889164
@slightwv:

We are using java - provider jdbc for oracle

I spoke to my team member letting him know that he needs to write a routine to display CLOB from db

Thanks
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 400 total points
ID: 34889219
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Action link in Union Reports Not Working in OBIEE 11g 1 85
report returning null 21 93
Wrap Oraccle SQL*Plus executable Command 4 83
PAYER_ID has both atributes 4 37
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to take different types of Oracle backups using RMAN.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question