使用shell脚本导出clob数据

发布于 2025-01-21 15:26:22 字数 680 浏览 3 评论 0原文

我正在尝试从表中导出clob数据。我正在尝试导出数据并将其存储在TXT文件中。

有多个相关的问题,我几乎尝试了一切,但我无法实现。数据仅导出最多4000个字符。

以下是我的步道: -

 test.sql

 SELECT  A.ID , DBMS_LOB.substr(A.USERS,32767) , DBMS_LOB.substr(B.NAME,32767)
 FROM TEST A , TABLE B
  WHERE
    A.ID = B.ID;

test.sh
  
  #!/usr/bin/bash
   FILE=test.txt
   nohup sqlplus SCMH/PWD@DB << EOF

   set colsep ","
   set headsep off
   set pagesize 0
   set trimspool on
   set linesize 30000
   set numw 15
   SET BUFFER 30000

   SPOOL $FILE
   @test.sql
   SPOOL OFF
   EXIT
   EOF
 exit

我能够如上所述导出数据,但只有4K字符即将到来。 CLOB中的总数据大于4K。

CLOB数据是单行数据,例如ABC; XYZ; ..........

任何建议都有很大的帮助。

问候

I am trying to export CLOB data from tables . I am trying to export the data and store it in a txt file.

There are multiple related questions and I have almost tried everything but I am unable to achieve it . The data gets exported only upto 4000 characters.

Below is my trail :--

 test.sql

 SELECT  A.ID , DBMS_LOB.substr(A.USERS,32767) , DBMS_LOB.substr(B.NAME,32767)
 FROM TEST A , TABLE B
  WHERE
    A.ID = B.ID;

test.sh
  
  #!/usr/bin/bash
   FILE=test.txt
   nohup sqlplus SCMH/PWD@DB << EOF

   set colsep ","
   set headsep off
   set pagesize 0
   set trimspool on
   set linesize 30000
   set numw 15
   SET BUFFER 30000

   SPOOL $FILE
   @test.sql
   SPOOL OFF
   EXIT
   EOF
 exit

I am able to export the data as mentioned but only 4K characters are coming . The total data in CLOB is much more than 4K.

The CLOB data is single line data e.g abc;xyz;..........

Any suggestions would be of great help.

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文