Jeff Roe
Jeff Roe

Reputation: 3206

Oracle SQL Developer: How to display full column names in textual SELECT output

Given this schema and data:

create table my_table
(
    my_key   number(8,0),
    string_1 varchar2(7),
    string_2 varchar2(7)
)
/
commit;
insert into my_table values (1, 'hello', 'bonjour');
commit;

When I select * from my_table I get this output:

    MY_KEY STRING_ STRING_
---------- ------- -------
         1 hello   bonjour

As you can see, the column names it gives me are:

I would like to see the complete column names in the text output (F5). I know I can get the output in a nice grid (F9) with the full column names, but I want the data and full column names in text.

I would much prefer a solution which is not specific to this table and these columns. A single solution which fixes the output for all my tables would be much preferred to a one-off fix to these 2 particular columns.

Upvotes: 3

Views: 6116

Answers (3)

Tiago Cardoso
Tiago Cardoso

Reputation: 2097

I'm using SQL Developer v17.4. You have an option to choose how to auto-fit the column by right clicking on any column name.

Before selecting auto-fit: enter image description here

After applying auto-fit: enter image description here

Upvotes: 2

user5683823
user5683823

Reputation:

Are you familiar with SQL*Plus? What you are asking has to do with SQL*Plus formatting commands. They work the same in SQL Developer.

Specifically:

column string_1 format a8
column string_2 format a8

<now run your query again>

Note that the COLUMN commands do not require a ; at the end, since they are not SQL commands - they are not sent to the database, but instead they are interpreted and "executed" by SQL Developer itself.

Edit: Just noticed your last paragraph. No, unfortunately I don't think there is a universal fix. By default, the column width in the display is the width of the column in the database (the declared width for a base table, or the widest value in a column computed in a query); there is no way to override this default globally for all columns in all query results.

Upvotes: 1

Aszula
Aszula

Reputation: 163

Have you tried using Aliases?

Select My_Key, STRING_1 AS String_1, String_2 AS String_2 from my_table

Upvotes: 0

Related Questions