Re: sqlplus and feedback

From: Remigiusz Sokolowski <remigiusz.sokolowski_at_nordea.com>
Date: Fri, 10 Jan 2014 10:28:38 +0100
Message-ID: <52CFBD46.4080403_at_nordea.com>


  
    
  
  
    
I am not sure if my answer showed on the list, but the point is to generate a script while get rid of any unnecessary lines in order to get clean answer when run it. However after generating this script I would like to know how many items were generated

Finally I go with the following construction:
set feed off verify off pages 0 sqlprompt "---> "
spool _ciobj.sql
[select of interest]
spool off
set feed on verify on pages 1000
!echo -n '-- *** number of rows: '; grep -ci [a specific phrase from sql] _ciobj.sql




On 01/10/2014 01:09 AM, Tanel Poder wrote:
Do you want to spool the rows to a file or completely ignore the returned data? If ignore, then just SET AUTOTRACE TRACE STAT and it won't return any data (but will return the row count).

-- 
Tanel Poder
Enkitec (The Exadata Experts)



On Fri, Jan 10, 2014 at 1:49 AM, De DBA <dedba_at_tpg.com.au> wrote:
Hi Remigiusz,

If shell commands are acceptable, then you could use something like this to redirect the rows feedback to STDERR, while you spool the output to a file:

$ sp -s / <<EOF |awk '/rows/ { print $0 > "/dev/stderr" ; } { print $0; } ' >/my/output.txt
> select * from user_objects;
> exit
> EOF
100 rows selected.



-- 
Pole na kazi

----------------------------------------------------------------------
Remigiusz Sokolowski <remigiusz.sokolowski_at_nordea.com>
pos   : Senior DBA at DIiUSI
addr  : Nordea IT Polska Sp. z o.o., Luzycka 6A st, 81-537 Gdynia, Poland
phone : +48 58 667 17 43
mobile: +48 602 42 42 77
54.4952N 18.4332E

Nordea IT Polska Sp.z o.o. z siedzibą w 00-854 Warszawa, Al.Jana Pawła II 25, lok.IXp. wpisaną do Rejestru Przedsiębiorców Krajowego Rejestru Sądowego pod numerem: 0000429783, dla której dokumentację przechowuje Sąd Rejonowy dla M.St. Warszawy w Warszawie, XII Wydział Gospodarczy Krajowego Rejestru Sądowego, o kapitale zakładowym i opłaconym w wysokości: 40.000.000,00 złotych, NIP: 527-268-29-50, REGON: 146278110 Adres do korespondencji: 81-537 Gdynia, ul. Łużycka 6A


-- http://www.freelists.org/webpage/oracle-l Received on Fri Jan 10 2014 - 10:28:38 CET

Original text of this message