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

        <bdo id='L0LLO'></bdo><ul id='L0LLO'></ul>

      <small id='L0LLO'></small><noframes id='L0LLO'>

      <tfoot id='L0LLO'></tfoot>

        <legend id='L0LLO'><style id='L0LLO'><dir id='L0LLO'><q id='L0LLO'></q></dir></style></legend>
      1. 使用 PL/SQL 如何将文件内容放入 blob?

        时间:2023-11-03
      2. <i id='cgfo9'><tr id='cgfo9'><dt id='cgfo9'><q id='cgfo9'><span id='cgfo9'><b id='cgfo9'><form id='cgfo9'><ins id='cgfo9'></ins><ul id='cgfo9'></ul><sub id='cgfo9'></sub></form><legend id='cgfo9'></legend><bdo id='cgfo9'><pre id='cgfo9'><center id='cgfo9'></center></pre></bdo></b><th id='cgfo9'></th></span></q></dt></tr></i><div id='cgfo9'><tfoot id='cgfo9'></tfoot><dl id='cgfo9'><fieldset id='cgfo9'></fieldset></dl></div>

        <small id='cgfo9'></small><noframes id='cgfo9'>

            <tbody id='cgfo9'></tbody>
          <tfoot id='cgfo9'></tfoot>

              <legend id='cgfo9'><style id='cgfo9'><dir id='cgfo9'><q id='cgfo9'></q></dir></style></legend>

              • <bdo id='cgfo9'></bdo><ul id='cgfo9'></ul>

                  本文介绍了使用 PL/SQL 如何将文件内容放入 blob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个文件.我想将其内容放入我的 oracle 数据库中的 blob 列或放入我的 PL/SQL 程序中的 blob 变量中.最好的方法是什么?

                  I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?

                  推荐答案

                  要完全在 PL/SQL 中完成,文件需要在服务器上,位于您需要在数据库中定义的目录中.创建以下对象:

                  To do it entirely in PL/SQL, the file would need to be on the server, located in a directory which you'd need to define in the database. Create the following objects:

                  CREATE OR REPLACE DIRECTORY
                      BLOB_DIR
                      AS
                      '/oracle/base/lobs'
                  /
                  
                  
                  
                  CREATE OR REPLACE PROCEDURE BLOB_LOAD
                  AS
                  
                      lBlob  BLOB;
                      lFile  BFILE := BFILENAME('BLOB_DIR', 'filename');
                  
                  BEGIN
                  
                      INSERT INTO table (id, your_blob)
                          VALUES (xxx, empty_blob())
                          RETURNING your_blob INTO lBlob;
                  
                      DBMS_LOB.OPEN(lFile, DBMS_LOB.LOB_READONLY);
                  
                      DBMS_LOB.OPEN(lBlob, DBMS_LOB.LOB_READWRITE);
                  
                      DBMS_LOB.LOADFROMFILE(DEST_LOB => lBlob,
                                            SRC_LOB  => lFile,
                                            AMOUNT   => DBMS_LOB.GETLENGTH(lFile));
                  
                      DBMS_LOB.CLOSE(lFile);
                      DBMS_LOB.CLOSE(lBlob);
                  
                      COMMIT;
                  
                  END;
                  /
                  

                  这篇关于使用 PL/SQL 如何将文件内容放入 blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ORACLE/SQL Server 中的减法与除外差异 下一篇:如何只选择昨天的记录?

                  相关文章

                  <small id='BpJEz'></small><noframes id='BpJEz'>

                  <legend id='BpJEz'><style id='BpJEz'><dir id='BpJEz'><q id='BpJEz'></q></dir></style></legend>
                  <tfoot id='BpJEz'></tfoot>

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

                      • <bdo id='BpJEz'></bdo><ul id='BpJEz'></ul>