How to capture the screen of an SQL session
The following is a sample file (called hw3.sql) which contains
several SQL queries:
set echo on
-- (1) list all agents
select *
from agents;
-- (2) List agent names of agents who have supplied
-- part "p01"
select aname
from agents
where aid in (select aid
from orders
where agents.aid = orders.aid and
pid = 'p01');
-- (3) list all customers
select *
from customers;
set echo off
exit;
Once the above file is prepared, you should do the following:
$script hw3.dat
$sqlplus user/password
SQL>start hw2
$<CTRL>-D (to logout from shell)
At this point the file hw3.dat will contain the capture of the
SQL session. You must submit this file.