<small id='38jib'></small><noframes id='38jib'>

<i id='38jib'><tr id='38jib'><dt id='38jib'><q id='38jib'><span id='38jib'><b id='38jib'><form id='38jib'><ins id='38jib'></ins><ul id='38jib'></ul><sub id='38jib'></sub></form><legend id='38jib'></legend><bdo id='38jib'><pre id='38jib'><center id='38jib'></center></pre></bdo></b><th id='38jib'></th></span></q></dt></tr></i><div id='38jib'><tfoot id='38jib'></tfoot><dl id='38jib'><fieldset id='38jib'></fieldset></dl></div>

    • <bdo id='38jib'></bdo><ul id='38jib'></ul>
  1. <legend id='38jib'><style id='38jib'><dir id='38jib'><q id='38jib'></q></dir></style></legend>

    1. <tfoot id='38jib'></tfoot>

    2. 如何从 Oracle SQL 中的 BLOB 获取文本内容

      时间:2023-09-19

    3. <tfoot id='2YqqT'></tfoot>

          <tbody id='2YqqT'></tbody>

            • <bdo id='2YqqT'></bdo><ul id='2YqqT'></ul>

                <legend id='2YqqT'><style id='2YqqT'><dir id='2YqqT'><q id='2YqqT'></q></dir></style></legend>
                <i id='2YqqT'><tr id='2YqqT'><dt id='2YqqT'><q id='2YqqT'><span id='2YqqT'><b id='2YqqT'><form id='2YqqT'><ins id='2YqqT'></ins><ul id='2YqqT'></ul><sub id='2YqqT'></sub></form><legend id='2YqqT'></legend><bdo id='2YqqT'><pre id='2YqqT'><center id='2YqqT'></center></pre></bdo></b><th id='2YqqT'></th></span></q></dt></tr></i><div id='2YqqT'><tfoot id='2YqqT'></tfoot><dl id='2YqqT'><fieldset id='2YqqT'></fieldset></dl></div>

                <small id='2YqqT'></small><noframes id='2YqqT'>

              1. 本文介绍了如何从 Oracle SQL 中的 BLOB 获取文本内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我试图从 SQL 控制台查看 Oracle BLOB 中的内容.

                我知道它包含的文本体量有点大,我只想查看文本,但以下查询仅表明该字段中有一个 BLOB:

                select BLOB_FIELD from TABLE_WITH_BLOB where ID = '';

                我得到的结果并不完全符合我的预期:

                <前>BLOB_FIELD-----------------------oracle.sql.BLOB@1c4ada9

                那么我可以做什么样的魔法咒语才能将 BLOB 变成它的文本表示?

                PS:我只是想从 SQL 控制台(Eclipse Data Tools)查看 BLOB 的内容,而不是在代码中使用它.

                解决方案

                首先,您可能希望将文本存储在 CLOB/NCLOB 列中,而不是专为二进制数据设计的 BLOB(您的查询将使用 CLOB,顺便说一句).

                以下查询将让您看到 blob 中文本的前 32767 个字符(最多),前提是所有字符集都兼容(存储在 BLOB 中的文本的原始 CS,用于 VARCHAR2 的数据库的 CS) :

                select utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD)) from TABLE_WITH_BLOB where ID = '';

                I am trying to see from an SQL console what is inside an Oracle BLOB.

                I know it contains a somewhat large body of text and I want to just see the text, but the following query only indicates that there is a BLOB in that field:

                select BLOB_FIELD from TABLE_WITH_BLOB where ID = '<row id>';
                

                the result I'm getting is not quite what I expected:

                    BLOB_FIELD
                    -----------------------
                    oracle.sql.BLOB@1c4ada9
                

                So what kind of magic incantations can I do to turn the BLOB into it's textual representation?

                PS: I am just trying to look at the content of the BLOB from an SQL console (Eclipse Data Tools), not use it in code.

                解决方案

                First of all, you may want to store text in CLOB/NCLOB columns instead of BLOB, which is designed for binary data (your query would work with a CLOB, by the way).

                The following query will let you see the first 32767 characters (at most) of the text inside the blob, provided all the character sets are compatible (original CS of the text stored in the BLOB, CS of the database used for VARCHAR2) :

                select utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD)) from TABLE_WITH_BLOB where ID = '<row id>';
                

                这篇关于如何从 Oracle SQL 中的 BLOB 获取文本内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在不复制数据的情况下创建 Oracle 表的副本? 下一篇:Oracle 中的布尔字段

                相关文章

                  <bdo id='i3CVl'></bdo><ul id='i3CVl'></ul>
                1. <legend id='i3CVl'><style id='i3CVl'><dir id='i3CVl'><q id='i3CVl'></q></dir></style></legend>

                    <i id='i3CVl'><tr id='i3CVl'><dt id='i3CVl'><q id='i3CVl'><span id='i3CVl'><b id='i3CVl'><form id='i3CVl'><ins id='i3CVl'></ins><ul id='i3CVl'></ul><sub id='i3CVl'></sub></form><legend id='i3CVl'></legend><bdo id='i3CVl'><pre id='i3CVl'><center id='i3CVl'></center></pre></bdo></b><th id='i3CVl'></th></span></q></dt></tr></i><div id='i3CVl'><tfoot id='i3CVl'></tfoot><dl id='i3CVl'><fieldset id='i3CVl'></fieldset></dl></div>
                    <tfoot id='i3CVl'></tfoot>
                  1. <small id='i3CVl'></small><noframes id='i3CVl'>