Solved

Inserting HTML into Oracle DB

Posted on 2007-11-29
7
1,951 Views
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
0
Comment
Question by:yellowhat
  • 3
  • 2
7 Comments
 
LVL 9

Expert Comment

by:joebednarz
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.
0
 

Author Comment

by:yellowhat
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

0
 

Author Comment

by:yellowhat
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
0
 
LVL 9

Expert Comment

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

SET SCAN OFF
INSERT ...
0
 
LVL 9

Accepted Solution

by:
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 SCAN OFF
SET LONG 2000000000
SET LONGCHUNKSIZE 2000000000

INSERT ....

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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
'G_F01' is not a procedure or is undefined 3 24
Process mapping 5 52
create a nested synonym 4 25
Need help constructing a conditional update query 16 46
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

772 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