Home » SQL & PL/SQL » SQL & PL/SQL » Column heading query
Column heading query [message #185958] Fri, 04 August 2006 09:04 Go to next message
james_briar
Messages: 39
Registered: April 2005
Location: Morden (South London)
Member
Hello all, i'm running this bit of test code in sqlplus :-

SQL> select 'AB' testing from dual;

TE
__

AB
When i run the same code from Toad the column heading is TESTING which is what i want :-

TESTING
__

AB

What do i need to set in the sqlplus environment to stop the column headings being truncated? I know "col testing format a7" will give me the right result but we have many sql queries with many columns being displayed. I'm not sure how Toad sorts this out.
icon14.gif  Re: Column heading query [message #186042 is a reply to message #185958] Sat, 05 August 2006 01:49 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
select ' AB ' testing from dual gives me

TESTING
-------
AB

but i am not able to get your could "col testing format a7"
how to use this?
Re: Column heading query [message #186053 is a reply to message #186042] Sat, 05 August 2006 06:14 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
James, I guess this is because TOAD <> SQL*Plus. I don't know what happens when you issue SELECT statement in TOAD - it, probably, dynamically sets column heading format.

Amul, I believe James was talking about this:
SQL> select 'ab' testing from dual;

TE
--
ab

SQL> column testing format a7
SQL> /

TESTING
-------
ab

SQL>
icon6.gif  Re: Column heading query [message #186131 is a reply to message #185958] Sun, 06 August 2006 06:28 Go to previous messageGo to next message
james_briar
Messages: 39
Registered: April 2005
Location: Morden (South London)
Member
Hello Amul and Littlefoot, thanks for replying. I'm still figuring out a way to stop the column headings being truncated when the data output is smaller than the column headings. We have many large SQL queries with many columns so i don't want to use the "COL" command everywhere etc.
Thanks.
Re: Column heading query [message #186158 is a reply to message #186131] Sun, 06 August 2006 11:05 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If your queries produce a huge heading line, perhaps you should consider developing reports in another reporting tool, not SQL*Plus. For example, Oracle Reports Builder, Crystal Reports, or even SQL Developer or TOAD. SQL*Plus is fine, but not almighty.
icon14.gif  Re: Column heading query [message #186295 is a reply to message #186158] Mon, 07 August 2006 06:21 Go to previous message
james_briar
Messages: 39
Registered: April 2005
Location: Morden (South London)
Member
Hello Littlefoot, i think i'll have a look at what you mentioned. Thanks again.
Previous Topic: difference between sql_trace and dbms_profiler
Next Topic: function parameters
Goto Forum:
  


Current Time: Sat Dec 03 10:02:41 CST 2016

Total time taken to generate the page: 0.16198 seconds