Экспорт CLOB к использованию текстового файла Oracle Разработчик SQL

Следующая версия Windows (Windows 7) сможет привязать окна на левую или правую половину экрана. Не помогает прямо сейчас, но это - что-то для нетерпеливого ожидания.

http://arstechnica.com/news.ars/post/20081028-first-look-at-windows-7.html

13
задан Franck Dernoncourt 26 July 2015 в 04:14
поделиться

3 ответа

if you have access to the file system on your database box you could do something like this:

CREATE OR REPLACE DIRECTORY documents AS 'C:\';
SET SERVEROUTPUT ON
DECLARE
  l_file    UTL_FILE.FILE_TYPE;
  l_clob    CLOB;
  l_buffer  VARCHAR2(32767);
  l_amount  BINARY_INTEGER := 32767;
  l_pos     INTEGER := 1;
BEGIN
  SELECT col1
  INTO   l_clob
  FROM   tab1
  WHERE  rownum = 1;

  l_file := UTL_FILE.fopen('DOCUMENTS', 'Sample2.txt', 'w', 32767);

  LOOP
    DBMS_LOB.read (l_clob, l_amount, l_pos, l_buffer);
    UTL_FILE.put(l_file, l_buffer);
    l_pos := l_pos + l_amount;
  END LOOP;
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.put_line(SQLERRM);
    UTL_FILE.fclose(l_file);
END;
/

Which I copied and pasted from this site.

You may also find this previous question about UTL_FILE useful. It addresses exporting to CSV. I have no idea or experience with how UTL_FILE handles CLOBs, however.

15
ответ дан 1 December 2019 в 23:48
поделиться

assuming by an Oracle dump you meant a .dmp (either from export or expdp), you're looking at a binary file. You'll need to import the dumpfile into an Oracle database and then export the data to plain text using UTL_FILE or other means.

0
ответ дан 1 December 2019 в 23:48
поделиться

Here is a short yet general python script that does just this - dumping tables (with CLOB fields, among the rest) to a flat csv file: OraDump

0
ответ дан 1 December 2019 в 23:48
поделиться
Другие вопросы по тегам:

Похожие вопросы: