Solved

Need a replacement data type in Oracle

Posted on 2016-11-23
6
78 Views
Last Modified: 2016-11-23
I have a couple of tables in a database that are using the LONG data type. It's a horrible data type and we need to get rid of it. The question is what do I replace it with? I've narrowed it down to LOB, BLOB, or CLOB but the differences between those seem subtle and I can't quite figure out which is the best choice and why. Some of the LONG fields are storing bitmap image data. Others are storing HTML markup text. I'm OK with using a different data type for each of those. I just need to get rid of the LONG.
0
Comment
Question by:Russ Suter
  • 3
  • 2
6 Comments
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 41899757
LONG data types are actually no longer supported.  I believe that support for them was dropped in Oracle 9.

For character data (like HTML) use CLOB.
For binary data (like images) use BLOB.

LOB is just a general term for both of them.
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 41899758
For bitmap image data, you have to use a: BLOB (short for Binary Large OBjects).  For html data, you can use a: CLOB (short for Character Large OBjects).  I think a LOB is just a newer replacement for LONG, but still ambiguous, since it can contain either binary or character data.
0
 
LVL 20

Author Comment

by:Russ Suter
ID: 41899760
That's basically what I thought. Is there any reason why I can't use a BLOB to store the HTML data also?
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 34

Expert Comment

by:johnsone
ID: 41899763
There is no reason you cannot store HTML in a BLOB.  CLOB has more features (like you can do substrings and things like that).
0
 
LVL 20

Author Comment

by:Russ Suter
ID: 41899767
That's good to know. Obviously we're not using substrings and things like that with the LONG data type so it sounds like we won't be missing anything by just using BLOB.
0
 
LVL 34

Expert Comment

by:johnsone
ID: 41899770
You probably wouldn't be missing anything, but it allows you do do more things without having to convert it later.
1

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DBF to ... Converter 5 71
Multiple MSSQL instances on same server 4 42
dbms_crypto.decrypt   errors out 6 31
How do uses indexes to maximize MySQL Searches 14 37
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Big data transfers via information superhighways require special attention and protection. Learn more about the IT-regulations of the country where your server is located. Analyze cloud providers and their encryption systems for safe data transit. S…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to recover a database from a user managed backup

831 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