Run DB-Access in interactive mode without menus
If you do not want to use the menus and do not have a prepared SQL file, use your keyboard or standard input device to enter SQL statements from the command line.
When you start DB-Access without a menu argument and with a hyphen as the final argument, DB-Access processes commands from the standard input device (on UNIX™) or the keyboard (on Windows™). DB-Access reads what you type until you indicate that the input is completed. Then DB-Access processes your input and writes the results to the standard output device (on UNIX), or the command window (on Windows).
DB-Access reads and runs SQL statements from the terminal keyboard interactively. While DB-Access runs interactively, the greater than (>) prompt marks the line where you type your next SQL statement.
dbaccess - -
>database stores_demo;
Database selected.
>select count(*) from systables;
(count(*))
21
1 row(s) retrieved.
>^D
dbaccess - -
>database stores_demo;
Database selected.
>select count(*) from systables;
(count(*))
21
1 row(s) retrieved.
>^D
Batch command input (UNIX)
dbaccess mystores- <<EOT!
select avg(customer_num) from customer
where fname matches '[A-G]*';
EOT!
echo 'select count(*) from systables' | dbaccess mystores
dbaccess mystores -
>select
!echo hello
>hello
count(*) from systables;
>
(count(*))
21
1 row(s) retrieved.
>
View and rerun DB-Access commands
You can view and rerun DB-Access commands that you ran from the command line during the current session.
To view the previous commands, run the dbaccess -history command. In the following example, the command history shows three previous commands:
dbaccess -history - -
1> create database sales_demo;
Database created.
2> create table customer (
2> customer_code integer,
2> customer_name char(31),
2> company_name char(20));
Table created.
3> insert into customer values (102, "Carole Sadler", "Sports Spot");
1 row(s) inserted.
4> history;
1 create database sales_demo
2 create table customer (
customer_code integer,
customer_name char(31),
company_name char(20))
3 insert into customer values (102, "Carole Sadler", "Sports Spot")
You can rerun the third command by running the run 3 command:
4> run 3;
1 row(s) inserted.