how to increase sqlplus column output length?

后端 未结 10 2076
萌比男神i
萌比男神i 2021-01-30 12:45

I have some queries to find out the ddl of some objects from a schema. The result columns I am getting are truncated in the middle of the queries.

How can I increase the

相关标签:
10条回答
  • 2021-01-30 13:10

    What I use:

    set long 50000
    set linesize 130
    
    col x format a80 word_wrapped;
    select dbms_metadata.get_ddl('TABLESPACE','LM_THIN_DATA') x from dual;
    

    Or am I missing something?

    0 讨论(0)
  • 2021-01-30 13:15

    Actually, even that didn't work for me. When I executed "select dbms_metadata.get_ddl('TABLESPACE','TABLESPACE_NAME') from dual;" I again got only the first three lines, but this time each line was padded out to 15,000 characters. I was able to work around this with:

    select substr(dbms_metadata.get_ddl('TABLESPACE','LM_THIN_DATA'),80) from dual;
    select substr(dbms_metadata.get_ddl('TABLESPACE','LM_THIN_DATA'),160) from dual;
    select substr(dbms_metadata.get_ddl('TABLESPACE','LM_THIN_DATA'),240) from dual;
    

    It sure seemed like there ought to be an easier way, but I couldn't seem to find it.

    0 讨论(0)
  • 2021-01-30 13:17

    Try this

    COLUMN col_name FORMAT A24

    where 24 is you width.

    0 讨论(0)
  • 2021-01-30 13:20

    None of these suggestions were working for me. I finally found something else I could do - dbms_output.put_line. For example:

    SET SERVEROUTPUT ON
    begin
    for i in (select dbms_metadata.get_ddl('INDEX', index_name, owner) as ddl from all_indexes where owner = 'MYUSER') loop
      dbms_output.put_line(i.ddl);
    end loop;
    end;
    /
    

    Boom. It printed out everything I wanted - no truncating or anything like that. And that works straight in sqlplus - no need to put it in a separate file or anything.

    0 讨论(0)
提交回复
热议问题