Home » SQL & PL/SQL » Client Tools » output formatting
output formatting [message #258187] Fri, 10 August 2007 09:30 Go to next message
durai
Messages: 38
Registered: December 2006
Member
vanakkam to all,

is it possible to display the output result in a underline format;

EG:
SELECT a,b,c FROM TEST;
A B C
10 aaa 01cs01
20 aaa 01cs02
30 aaa 01cs03
40 bbb 01cs04
50 ccc 01cs05

here in above i need the output of column C in underline format

thanx in advance to all
Re: output formatting [message #258194 is a reply to message #258187] Fri, 10 August 2007 09:46 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
No.
Individual clients may be set up to display certain values with underlines, but there is no way of having the data itself carry some sort of universal 'underline me' marker
Re: output formatting [message #258201 is a reply to message #258194] Fri, 10 August 2007 10:02 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
The actual query is like this;
SELECT a,b,c from TEST;
A B C
10 aaa 01cs01
20 aaa 01cs02
30 aaa 01cs03
40 bbb 01cs04
50 ccc 01cs05
60 ccc 01cs06

but what i am asking is,
is it possible to display the result in a underline format,
like the one below

SELECT a,b,c from TEST;
A B C
10 aaa 01cs01
20 aaa 01cs02
30 aaa 01cs03
40 bbb 01cs04
50 ccc 01cs05
60 ccc 01cs06

i don't want to store the values permanently in my table
just i want to display the output in a underline format

i am using SQL*Plus: Release 9.2.0.1.0

[Updated on: Fri, 10 August 2007 10:03]

Report message to a moderator

Re: output formatting [message #258204 is a reply to message #258201] Fri, 10 August 2007 10:06 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't.
SQL*Plus doesn't know any formatting, it just display string in plain text format.

Regards
Michel
Re: output formatting [message #258277 is a reply to message #258204] Fri, 10 August 2007 14:32 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Here is an example that will work on most Unix/ Linux terminals:

$ sqlplus scott/tiger @myscript.sql `tput sgr 0 1` `tput sgr 0 0`


&&1 will have the termcode to start underlining (tput sgr 0 1)
&&2 will have the termcode to stop underlining (tput sgr 0 0)

Next, embed the formatting codes into your query:

select empno, '&&1'||ename||'&&2' as name from emp


Re: output formatting [message #258334 is a reply to message #258277] Sat, 11 August 2007 02:55 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
Hai Frank,
First i thanking you for your kindly response,

I tried the codes given by you but it's seems not working, i tried the steps below(correct me if i wrong)

i created myscript.sql
spool myscript.txt

select a, '&&1'||c||'&&2' as name from trail1;

spool off

after saving i run the program as
sql>@myscript.sql `tput sgr 0 1` `tput sgr 0 0`
SQL> @myscr.sql `tput sgr 0 1` `tput sgr 0 0`
old 1: select a, '&&1'||c||'&&2' as name from trail1
new 1: select a, '`tput'||c||'sgr' as name from trail1

A NAME
---------- ------------------
10 `tput01cs01sgr
20 `tput01cs02sgr
30 `tput01cs03sgr
40 `tput01cs04sgr
50 `tput01cs05sgr
60 `tput01cs06sgr

i got the O/P as above and not the exact one i want

`tput sgr 0 1` `tput sgr 0 0` this are unix commands isn't it
can u guide me how to embed this to sql command

Once again thank you!
Re: output formatting [message #258339 is a reply to message #258334] Sat, 11 August 2007 03:22 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
You need to start your script (can be a dummy script) from command line to feed the termcodes into sqlplus variables (&&1 and &&2).
Re: output formatting [message #258351 is a reply to message #258339] Sat, 11 August 2007 04:45 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
i couldn't able to follow you sir, since i don't know much about unix scripting,

can u show me some example there by i can implement.
Re: output formatting [message #258363 is a reply to message #258351] Sat, 11 August 2007 05:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
can u show me some example there by i can implement.

Frank Naude wrote on Fri, 10 August 2007 21:32
Here is an example that will work on most Unix/ Linux terminals:
$ sqlplus scott/tiger @myscript.sql `tput sgr 0 1` `tput sgr 0 0`

&&1 will have the termcode to start underlining (tput sgr 0 1)
&&2 will have the termcode to stop underlining (tput sgr 0 0)

Next, embed the formatting codes into your query:
select empno, '&&1'||ename||'&&2' as name from emp


Regards
Michel

Re: output formatting [message #258371 is a reply to message #258339] Sat, 11 August 2007 06:15 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
Frank Naude wrote on Sat, 11 August 2007 13:52
You need to start your script (can be a dummy script) from command line to feed the termcodes into sqlplus variables (&&1 and &&2).



It's working Thank You Frank
Re: output formatting [message #259226 is a reply to message #258371] Tue, 14 August 2007 14:59 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Thanks again to Frank for his constructive posts - and from avoiding a recent trend on Orafaq of some "senior members" to constantly make the poster or other contributers feel like fools.
Previous Topic: SQLPLUS Report with multiple queries
Next Topic: Parametrizing entire sections of an sql script
Goto Forum:
  


Current Time: Wed Dec 07 18:35:11 CST 2016

Total time taken to generate the page: 0.15442 seconds