Re: How to print column heading only in SQL plus

From: Eric <eric_at_deptj.eu>
Date: Sat, 14 Sep 2013 19:05:45 +0100
Message-ID: <slrnl399bp.50o.eric_at_teckel.deptj.eu>


On 2013-09-13, Mladen Gogala <gogala.mladen_at_gmail.com> wrote:
> On Fri, 13 Sep 2013 21:08:29 +0100, Eric wrote:
>
>> You can be _very_ arcane in SQL*Plus itself (see Tanel Poder's Snapper),
>> but I don't see why a shell script needs to be arcane, there are three
>> basic ways to call SQL*Plus from a shell:
>>
>> . sqlplus x/y_at_db1 @myscript.sql
>>
>> . sqlplus x/y_at_db1 <<HEREDOC
>>
>> . print "script stuff" | sqlplus x/y_at_db1
>>
>> Because you can replace the print by anything at all as long as it
>> generates a script, that one can possibly get a bit arcane, but almost
>> all the time there is no need to.
>
> I am sorry, but this doesn't pass my aesthetic muster. I much prefer
> doing programming tasks by using a programming language, like Perl or PHP.
> It is not only prettier, it's more efficient, too. Shell is meant for
> interacting with OS, not for interacting with Oracle. There are other
> databases which have tools to deal with shell scripts, primarily db2, but
> with Oracle, I am resorting to Perl whenever possible.

If I write Perl, no-one else on the site can understand it - sometimes I'm not sure I can. And it doesn't officially exist anyway, even though our database servers tend to have two installations, the one in oracle and the one in Data Protector (formerly omniback).

Anyway, shell is meant to glue programs together, I don't see why one of them shouldn't be SQL*Plus. If I want a database application I'll write that in whatever seems appropriate to the task and local expectations, but sometimes gluing bits together is the best (for the prevailing circumstances) way.

As for aesthetics, they are always (in part) a personal view, and I have enough trouble getting things done right for good technical reasons that there's no point trying on the aesthetic arguments.

All of which is a long way from the OP who asked a fairly simple question, I don't actually object to suggesting using a different tool, but we should answer the question as well (so I did).

Eric

-- 
ms fnd in a lbry
Received on Sat Sep 14 2013 - 20:05:45 CEST

Original text of this message