Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

URGENT---- What data type Shall I Use - Raw or varchar?

Posted on 2005-04-26
9
Medium Priority
?
1,456 Views
Last Modified: 2012-08-13
Hi,
   I have some raw data coming to me which will be stored in the database for future retrieval.
What data type can I use for this purpose? RAW or VARCHAR2?
If I use varchar, what could be the problems in future?
Regards,
Badri.
0
Comment
Question by:gvsbnarayana
9 Comments
 
LVL 11

Expert Comment

by:sujit_kumar
ID: 13873262
If your maximum data lenght is less than 32327 characters, then go for VARCHAR2. It's maintainance and code writing will be easier. If you feel your data lengh will exceed this value, the go for RAW.
0
 
LVL 5

Accepted Solution

by:
helpneed earned 150 total points
ID: 13873488
hi

it depends on what type of data u are goin to put check out the data first and put datatype accordingly

Variable for each row, up to 4000 bytes per row: Consider the character set (one-byte or multibyte) before setting size: A maximum size must be specified.  

RAW (size)  
 Variable-length raw binary data Variable for each row in the table, up to 2000 bytes per row. A maximum size must be specified. Provided for backward compatibility.  
 
The RAW and LONG RAW datatypes are provided for backward compatibility with existing applications. For new applications, you should use the BLOB and BFILE datatypes for large amounts of binary data.  

Use the RAW datatype to store binary data or byte strings (a sequence of graphics characters, for example). RAW data is not interpreted by Oracle. The maximum width of a RAW column is 255 bytes.
RAW data is like VARCHAR2 data, except that Oracle assumes nothing about the meaning of RAW data and does no character set conversions (ASCII to EBCDIC for example) when you transmit RAW data from one system to another.

regards
0
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 150 total points
ID: 13873596
It depends what you mean under "some raw data". If this are alphabetical characters (letters, numbers, special characters) constituting an readable text you should use VARCHAR2 (up to 4000 characters and less - if use UTF8) or CBLOB (up to 4 GB).

If you mean binary data (not considered as text and not formatted for NLS purposes) you have to use RAW or BLOB (BFILE) according the lenght of the raw.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Assisted Solution

by:kripa_odba
kripa_odba earned 150 total points
ID: 13873700
Hi Narayana,

    You have some options in oracle  to store RAW data,it all depents on the data which you are going to store.
You can user LONG datatype to store character data that are converted when moved from one database to the other. LONGs can store up to 2 gigabytes.But in 9i its a deprecated datatype. Or you can go for RAW datatype which is used to store data that won't be converted by Oracle. RAW can be up to 2000 bytes and LONG RAW up to 2 gigabytes.Use CLOB or NCLOB for character data and BLOB for binary data.

rgds
kripa
0
 
LVL 4

Expert Comment

by:plamen73
ID: 13874169
In any case store exactly what is requested to store.
If it comes as RAW, store as RAW.
Oracle "almost" does not support RAW type.
So, finally, I do recommend you BLOB type. it is perfect to store RAW data. In addition, DBMS_LOB package provides a variaty of procedures to handle it
0
 
LVL 4

Assisted Solution

by:plamen73
plamen73 earned 150 total points
ID: 13874170
In any case store exactly what is requested to store.
If it comes as RAW, store as RAW.
Oracle "almost" does not support RAW type.
So, finally, I do recommend you BLOB type. it is perfect to store RAW data. In addition, DBMS_LOB package provides a variaty of procedures to handle it
0
 
LVL 4

Expert Comment

by:schubach
ID: 13874225
Here you can find a listing of all Oracle data types, with a good explanation of their differences:
http://www.ss64.com/orasyntax/datatypes.html
0
 
LVL 8

Author Comment

by:gvsbnarayana
ID: 14024595
Hi,
   I understand that I better use BLOB rather than RAW. But my application needs sub-second responses with 2000+ transactions per minute. Will the use of BLOB gives any performance problems when compared to RAW or VARCHAR?
I am sure that the raw data that will be less than 2000 bytes for each transaction.
Please advise me.
Regards,
Badri.
0
 
LVL 48

Expert Comment

by:schwertner
ID: 14024780
In this case you have to optimize the placement of the BLOBS on the disk devices.
This means (the ideal case) that you have to place the tablespace (or the files if you use BFILE) on a "not busy" disk device. This means that this disk has not overloaded by anothjer users requests. So it can work separately and to ensure the maximal fast response time.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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…

578 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