Home
Forums
New posts
Search forums
What's new
New posts
New resources
New profile posts
Latest activity
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
DMCA Policy
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
FEEL FREE TO SHARE TUTORIALS, YOUR SKILS & KNOWLEDGE ON CODING, SCRIPTS, THEMES, PLUGINS OR ANY RESOURCES YOU HAVE WITH THE COMMUNITY-
Click Here To Post Your Request,
JOIN COMPUTER REPAIR FORUM
Home
Forums
DATABASE CODING
SQL
CLOB and BLOB Datatypes in ORACLE/MYSQL
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Code55" data-source="post: 24" data-attributes="member: 14"><p>In this article we look into the difference between CLOB and BLOB datatypes in Oracle/MYSQL. We will also see about the description of each datatype and how to create attributes in a table with these datatypes.</p><p></p><p>So, CLOB and BLOB are types of Large Object Datatypes (LOB). LOB’s are a set of datatypes used to store or hold large amounts of data to access and manipulate the data efficiently. To learn more about Large Objects refer to <a href="https://docs.oracle.com/cd/B19306_01/appdev.102/b14249/adlob_intro.htm#i1009630" target="_blank">Oracle Documentations.</a></p><p></p><p></p><h2>CLOB</h2><p></p><p>CLOB stands for <strong>Character Large Object</strong>. It is a built in datatype used to store large textual data with variable length holding up to <strong>2,147,483,647 bytes of characters</strong> i.e. up to 2 GB long. It can store both single byte or multiple byte character streams. The CLOB datatype is represented using the <strong>java.sql.Clob</strong> interface in the JDBC API in Java. The CLOB object in JDBC holds a logical pointer to SQL CLOB. In other words, the object points to the location of the data instead of holding its character data.</p><p></p><p><strong>CLOB Datatype Attribute in Oracle:</strong></p><p></p><p>Column_Name CLOB</p><p></p><p><strong>Note: </strong>We do not need to specify CLOB Size while declaring the attribute by default size is 2,147,483,647.</p><p></p><p>MYSQL supports CLOB Datatype Attribute using only <strong>TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.</strong></p><p><strong></strong></p><p><strong>Example: </strong></p><p></p><p>Column_Name LONGTEXT</p><p></p><p></p><h2>BLOB</h2><p></p><p>BLOB stands for <strong>Binary Large Object</strong>, a built in datatype used to store large data in form of binary streams with a maximum length of <strong>65,535 bytes or 64 KB</strong>. It generally stores non-traditional data such as files including voice, images and mixed data etc. The BLOB datatype is represented using the <strong>java.sql.Blob</strong> interface in the JDBC API in Java. The BLOB object in JDBC holds a logical pointer to SQL BLOB i.e. the object points to the location of the data instead of holding its binary data.</p><p></p><p><strong>In ORACLE as well as in MYSQL, BLOB datatype is defined as:</strong></p><p></p><p>Column_Name BLOB</p><p></p><p>However, MYSQL supports BLOB with following datatypes as well : <strong>TINYBLOB, MEDIUMBLOB and, LONGBLOB</strong>.</p><p></p><p>Now, Let us look how these datatypes fit in the schema while creating a table in ORACLE.</p><p></p><p>CREATE TABLE BOOK_DETAILS</p><p>(</p><p>Book_Id NUMBER,</p><p>About_Book CLOB,</p><p>Book_Logo BLOB</p><p>);</p><p></p><p><strong>Explanation:</strong></p><p></p><p>About_Book attribute of table BOOK_DETAILS contains description about a book which may require large textual data so in this case it is more appropriate to use CLOB and field Book_Logo stores the book logo, an image resource so BLOB datatype goes well with this field.</p><p></p><p>In MYSQL this is implemented as follows:</p><p></p><p>CREATE TABLE BOOK_DETAILS</p><p>(</p><p>Book_Id NUMBER,</p><p>About_Book LONGTEXT,</p><p>Book_Logo BLOB</p><p>);</p><p></p><p></p><h2>Difference between CLOB and BLOB</h2><p></p><p>Now, let’s look at some key differences between the two and compare them.</p><p></p><p>�</p><table style='width: 100%'><tr><td><p style="text-align: center"><strong>CLOB</strong></p> </td><td><p style="text-align: center"><strong>BLOB</strong></p> </td></tr><tr><td>1. The abbreviation stands for <strong>Character Large Object.</strong></td><td>1. It stands for <strong>Binary Large Object</strong>.</td></tr><tr><td>2.This datatype stores large textual data in the form of character streams with a maximum length of <strong>2,147,483,647 character bytes i.e. up to 2GB long.</strong></td><td>2. This datatype stores large binary data in the form of binary or bitstreams with a maximum of <strong>65535 characters or 64 KB long.</strong></td></tr><tr><td>3. Mainly used to store files with text information such as text files, PDF documents etc.</td><td>3. Generally stores files including media data such as images, videos ,audio files etc.</td></tr><tr><td>4. Oracle supports this using CLOB while MYQL supports this datatype using only alias of TEXT type such as:</td><td></td></tr></table> <ul> <li data-xf-list-type="ul"><strong>TINYTEXT</strong></li> <li data-xf-list-type="ul"><strong>MEDIUMTEXT</strong></li> <li data-xf-list-type="ul"><strong>LONGTEXT</strong></li> </ul><p>[TD]4. Oracle as well as MYSQL supports this datatype using BLOB after field name. However MYSQL also has various implementations of this such as:[/TD]</p><p></p><ul> <li data-xf-list-type="ul"><strong>TINYBLOB</strong></li> <li data-xf-list-type="ul"><strong>MEDIUMBLOB</strong></li> <li data-xf-list-type="ul"><strong>LONGBLOB</strong></li> </ul><p>[TR]</p><p>[TD]5. Present in JDBC API as <strong>java.sql.Clob</strong> interface and implemented using <strong>SQL Locator</strong>.[/TD]</p><p> [TD]5. Present in JDBC API as <strong>java.sql.Blob</strong> interface and implemented using <strong>SQL Locator</strong>.[/TD]</p><p>[/TR]</p><p></p><p>That’s all for the article you can create a table with the following attributes shown in the example, add some records and see it in working!</p><p></p><p>You can ask your queries in the comment section below.</p><p></p><p>The post <a href="https://www.thecrazyprogrammer.com/2021/02/difference-between-clob-and-blob.html" target="_blank">Difference between CLOB and BLOB Datatypes in ORACLE/MYSQL</a> appeared first on <a href="https://www.thecrazyprogrammer.com" target="_blank">The Crazy Programmer</a>.</p><p></p><p><a href="https://www.thecrazyprogrammer.com/2021/02/difference-between-clob-and-blob.html" target="_blank">Continue reading...</a></p></blockquote><p></p>
[QUOTE="Code55, post: 24, member: 14"] In this article we look into the difference between CLOB and BLOB datatypes in Oracle/MYSQL. We will also see about the description of each datatype and how to create attributes in a table with these datatypes. So, CLOB and BLOB are types of Large Object Datatypes (LOB). LOB’s are a set of datatypes used to store or hold large amounts of data to access and manipulate the data efficiently. To learn more about Large Objects refer to [URL='https://docs.oracle.com/cd/B19306_01/appdev.102/b14249/adlob_intro.htm#i1009630']Oracle Documentations.[/URL] [HEADING=1]CLOB[/HEADING] CLOB stands for [B]Character Large Object[/B]. It is a built in datatype used to store large textual data with variable length holding up to [B]2,147,483,647 bytes of characters[/B] i.e. up to 2 GB long. It can store both single byte or multiple byte character streams. The CLOB datatype is represented using the [B]java.sql.Clob[/B] interface in the JDBC API in Java. The CLOB object in JDBC holds a logical pointer to SQL CLOB. In other words, the object points to the location of the data instead of holding its character data. [B]CLOB Datatype Attribute in Oracle:[/B] Column_Name CLOB [B]Note: [/B]We do not need to specify CLOB Size while declaring the attribute by default size is 2,147,483,647. MYSQL supports CLOB Datatype Attribute using only [B]TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT. Example: [/B] Column_Name LONGTEXT [HEADING=1]BLOB[/HEADING] BLOB stands for [B]Binary Large Object[/B], a built in datatype used to store large data in form of binary streams with a maximum length of [B]65,535 bytes or 64 KB[/B]. It generally stores non-traditional data such as files including voice, images and mixed data etc. The BLOB datatype is represented using the [B]java.sql.Blob[/B] interface in the JDBC API in Java. The BLOB object in JDBC holds a logical pointer to SQL BLOB i.e. the object points to the location of the data instead of holding its binary data. [B]In ORACLE as well as in MYSQL, BLOB datatype is defined as:[/B] Column_Name BLOB However, MYSQL supports BLOB with following datatypes as well : [B]TINYBLOB, MEDIUMBLOB and, LONGBLOB[/B]. Now, Let us look how these datatypes fit in the schema while creating a table in ORACLE. CREATE TABLE BOOK_DETAILS ( Book_Id NUMBER, About_Book CLOB, Book_Logo BLOB ); [B]Explanation:[/B] About_Book attribute of table BOOK_DETAILS contains description about a book which may require large textual data so in this case it is more appropriate to use CLOB and field Book_Logo stores the book logo, an image resource so BLOB datatype goes well with this field. In MYSQL this is implemented as follows: CREATE TABLE BOOK_DETAILS ( Book_Id NUMBER, About_Book LONGTEXT, Book_Logo BLOB ); [HEADING=1]Difference between CLOB and BLOB[/HEADING] Now, let’s look at some key differences between the two and compare them. � [TABLE] [TR] [TD][CENTER][B]CLOB[/B][/CENTER][/TD] [TD][CENTER][B]BLOB[/B][/CENTER][/TD] [/TR] [TR] [TD]1. The abbreviation stands for [B]Character Large Object.[/B][/TD] [TD]1. It stands for [B]Binary Large Object[/B].[/TD] [/TR] [TR] [TD]2.This datatype stores large textual data in the form of character streams with a maximum length of [B]2,147,483,647 character bytes i.e. up to 2GB long.[/B][/TD] [TD]2. This datatype stores large binary data in the form of binary or bitstreams with a maximum of [B]65535 characters or 64 KB long.[/B][/TD] [/TR] [TR] [TD]3. Mainly used to store files with text information such as text files, PDF documents etc.[/TD] [TD]3. Generally stores files including media data such as images, videos ,audio files etc.[/TD] [/TR] [TR] [TD]4. Oracle supports this using CLOB while MYQL supports this datatype using only alias of TEXT type such as:[/TD] [TD][/TD] [/TR] [/TABLE] [LIST] [*][B]TINYTEXT[/B] [*][B]MEDIUMTEXT[/B] [*][B]LONGTEXT[/B] [/LIST] [TD]4. Oracle as well as MYSQL supports this datatype using BLOB after field name. However MYSQL also has various implementations of this such as:[/TD] [LIST] [*][B]TINYBLOB[/B] [*][B]MEDIUMBLOB[/B] [*][B]LONGBLOB[/B] [/LIST] [TR] [TD]5. Present in JDBC API as [B]java.sql.Clob[/B] interface and implemented using [B]SQL Locator[/B].[/TD] [TD]5. Present in JDBC API as [B]java.sql.Blob[/B] interface and implemented using [B]SQL Locator[/B].[/TD] [/TR] That’s all for the article you can create a table with the following attributes shown in the example, add some records and see it in working! You can ask your queries in the comment section below. The post [URL='https://www.thecrazyprogrammer.com/2021/02/difference-between-clob-and-blob.html']Difference between CLOB and BLOB Datatypes in ORACLE/MYSQL[/URL] appeared first on [URL='https://www.thecrazyprogrammer.com']The Crazy Programmer[/URL]. [URL='https://www.thecrazyprogrammer.com/2021/02/difference-between-clob-and-blob.html']Continue reading...[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Richest Freecoded User
Most Freecoin
freecoded
4,876 Freecoin
J
Johnhendrick
645 Freecoin
S
Smith16
607 Freecoin
Davy200
590 Freecoin
nathan69
426 Freecoin
Laureine
415 Freecoin
A
anajeen
395 Freecoin
P
Peterparker87
331 Freecoin
C
codeguru
282 Freecoin
Tekera
267 Freecoin
Home
Forums
DATABASE CODING
SQL
CLOB and BLOB Datatypes in ORACLE/MYSQL
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top