Re: How to save commands into a file then run them again?

From: David Bath <dtb_at_otto>
Date: 19 Oct 92 06:11:09 GMT
Message-ID: <dtb.719475069_at_otto>


cxd653_at_huxley.anu.edu.au (Chunping Ding) writes:

>When I use sqlplus to organize a report, I have to write many
>commands, for example,
 

>SQL> title center 'Test report';
>SQL> column ename heading "Employee|name' format A8;
>SQL> set pagesize 100;
>SQL> set linesize 88;
>SQL> select *
>2 from emp
>3 where depno = 30;
 

>Is there any method to save all the commands into a file, then run the
>file? Do I have to type all the commands every time? I know I can save

I use vi, under UNIX and run sqlplus under it.

Enter your commands into the buffer, then simply :%!sqlplus -s /

BINGO ! the results come back into your buffer. If they are stuffed, hit "u" and your commands will be back.

This feature of vi is rarely used, but is really handy.

Say I am editing a script or pro*c file. I simply go to an empty line in by buffer and enter in DESC LITTLEKNOWNTABLE
Then using
!!sqlplus -s /
or
:.!sqlplus -s /

the description of the table automatically comes into my edit buffer and I can cut and past it to build my select statement or whatever.

Unfortunately, if you are in OZ and want more details, or other goodies, you'll have to contact my employer and pay us. Otherwise, check out vi(1) doco on your system.

If you do not have vi then tough. If you are on VMS - do not fret - use elvis instead/



David T. Bath
email: 	dtb_at_otto.bf.rmit.oz.au
Work: 	Global Technology Corporation, Carlton, Vic, OZ  (03) 3477511
"Failure to emulate is the best revenge" - Marcus Aurelius
-- 
David T. Bath
email: 	dtb_at_otto.bf.rmit.oz.au
Work: 	Global Technology Corporation, Carlton, Vic, OZ  (03) 3477511
#include <disclaimer.h>
Received on Mon Oct 19 1992 - 07:11:09 CET

Original text of this message