Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to increase sqlplus column output length?

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 width of the column?

I tried with

SET SERVEROUTPUT ON SIZE 1000000; SET LINESIZE 50000; set pagesize 50000; set long 50000; 

But I'm still getting the same result.

like image 272
Mohamed Saligh Avatar asked Sep 12 '11 07:09

Mohamed Saligh


People also ask

How do I adjust column width in SQL?

In this case, you need to use ALTER TABLE statement to increase column size. ALTER TABLE table_name MODIFY column_name varchar(new_length); In the above command, you need to specify table_name whose column you want to modify, column_name of column whose length you want to change, and new_length, new size number.

What is set long in Oracle?

Synopsis. The LONG setting controls the number of characters displayed by SQL*Plus from any LONG columns returned by a query.


2 Answers

I've just used the following command:

SET LIN[ESIZE] 200 

(from http://ss64.com/ora/syntax-sqlplus-set.html).

EDIT: For clarity, valid commands are SET LIN 200 or SET LINESIZE 200.

This works fine, but you have to ensure your console window is wide enough. If you're using SQL Plus direct from MS Windows Command Prompt, the console window will automatically wrap the line at whatever the "Screen Buffer Size Width" property is set to, regardless of any SQL Plus LINESIZE specification.

As suggested by @simplyharsh, you can also configure individual columns to display set widths, using COLUMN col_name FORMAT Ax (where x is the desired length, in characters) - this is useful if you have one or two extra large columns and you just wish to show a summary of their values in the console screen.

like image 101
m-smith Avatar answered Sep 27 '22 17:09

m-smith


This configuration is working for me:

set termout off set verify off set trimspool on set linesize 200 set longchunksize 200000 set long 200000 set pages 0 column txt format a120 

The column format definition with the linesize option helped to avoid the truncation at 80 chars.

like image 41
Martin Irigaray Avatar answered Sep 27 '22 17:09

Martin Irigaray