Inserting HTML into Oracle DB

Posted on 2007-11-29
Last Modified: 2013-12-18
I want to insert HTML code in excess of 4000 characters into an Oracle CLOB field, but am experiencing errors when updating the code

Think I have two problems, the first is I think html values such as & appear to be being treated as variables when they shouldnt, the second is that the info isnt being inserted as it apparently is too big for the CLOB

Swift assistance on this one would be greatly appreciated - deadline is tomorrow
Question by:yellowhat
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 20375291
Are you using PL/SQL or SQL?

If you are using SQL, try using "SET SCAN OFF" before running your script.

As far as a CLOB not taking more than 4000 characters, it seems odd... you have a 2GB limit on CLOB's... why not provide some examples of what you are doing.

Author Comment

ID: 20375485
Hi thanks for your reply, sorry Im not sure what sql version im using other than the fact that im running the queries on Oracle! Ive always dealt with MySQL up until now and this has never been a problem.

Ive attatched some modified code with the syntax intact.

The part "'blaba & lots &&   lots of text......'" is where Im having the problems, If I enter text here that doesnt contain an & sign and the contents are short it works fine but when &'s exist thats when the problems happen, im dealing with html so I need to be able to store these basic values.

Ive been using Toad for administrating the db and running the query with the &'s brings up a variables dialogue box?

SET SCAN OFF INSERT INTO TBL_COURSEDETAIL ( A, B, C, D, E, F, G, H, I ) VALUES ( 'blaba', 'blaba', 'blaba & lots &&   lots of text......', 'blaba', 'blaba', 'blaba', 'blaba', 'blaba', 'blaba' )

Open in new window


Author Comment

ID: 20375502
just realised the code has the SET SCAN OFF text in there, I didnt mean to post this as I was trying out the suggested solution, unfortunately this didnt work

Expert Comment

ID: 20375552
I'm pretty sure you have to have those separated new line...


Accepted Solution

joebednarz earned 500 total points
ID: 20375613
If you are going to use SQL*Plus to enter the data, try adding this to your script:

SET LONG 2000000000


Explanation... the values for LONG and LONGCHUNKSIZE determine how much data can be shown for LONG and LOB columns.

Featured Post

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

627 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