Re: How to print column heading only in SQL plus

From: Eric <eric_at_deptj.eu>
Date: Thu, 12 Sep 2013 19:45:53 +0100
Message-ID: <slrnl342v1.c80.eric_at_teckel.deptj.eu>


On 2013-09-12, Mladen Gogala <gogala.mladen_at_gmail.com> wrote:
> On Sat, 07 Sep 2013 01:05:30 -0700, sdhaya wrote:
>
>> Hi,
>>
>> I want print extra column heading in sqlplus. ( Signature )
>>
>> Eg:
>>
>> Code List ABC Bank
>>
>> Code Name Amount Signature
>> --------- ----------------------- ----------- ------------
>> 100 ABC 10.00
>> 200 DEF 20.00
>> 300 JKL 30.00
>>
>>
>> I am unable to get the above result.
>>
>> SQL
>>
>> Column c1 format a10 Heading 'Code'
>> Column n2 format a20 Heading 'Name'
>> Column a1 format 99.99 Heading 'Amount'
>> Column filler format a10 Heading 'Signature'
>>
>> Select code c1, name n1, amount a1 from t1
>>
>> In the above sql, signature is not getting printed.
>>
>> please help..
>>
>> Dhaya
>
> sqlplus is not a reporting tool. For a simple report like this, try with
> Perl. If you need something more complex, there are things like Pentaho,
> Jasper, OpenReports or RLIB. I like RLIB because it has bindings for both
> Perl and PHP, despite the fact that it is the least popular of the listed
> tools.

Mladen, you are being unreasonable. If you think of it as an old-fashioned reporting tool, SQL*Plus is not that bad.

The thing to know here is that the column command merely sets properties for a column _if_ it is encountered in a query result, it does not make it appear. So if you change the query to

select code c1, name n2, amount a1, '' filler from t1;

you will indeed get the empty column you want. (Fixed the n1-n2 discrepancy also).

Eric

-- 
ms fnd in a lbry
Received on Thu Sep 12 2013 - 20:45:53 CEST

Original text of this message