Re: how to query oracle database and send output to screen

From: Galen Boyer <galenboyer_at_yahoo.com>
Date: 2000/07/29
Message-ID: <u7la48mi1.fsf_at_yahoo.com>#1/1


,----
| Hi,
| I need to query my oracle database 8.1.6 on solaris 7 and send the
| results to the screen. I might also need to send the output to a
| file. I've looked into DBD and DBI but there are some modifications
| that need to be done to some java oracle binaries to get it to work.
| I'd rather not modify these files on my production server. I've done
| this with informix:
|
| #!/usr/local/bin/perl
| $ENV{INFORMIXSERVER} = "n_shm";
| open DBACCESS, "| /u/informix/bin/dbaccess";
| print DBACCESS qq{
| database mydatabase\_at_n_shm;
| UNLOAD TO '/u/myfile'
| SELECT *
| FROM a_table;
| };
| close DBACCESS;
`----
#!/bin/sh
#THIS WILL SEND TO SCREEN
sqlplus login/password_at_instance << EOF select ....
;
EOF #!/bin/sh
#THIS WILL SEND TO file
sqlplus login/password_at_instance << EOF > file select ....
;
EOF This is unix specific, not Oracle. Substitute dbaccess and this will work as well.

I think Perl has this. I would be surprised if it didn't.

-- 
Galen Boyer
Database Architect
Primix Solutions, www.primix.com
Received on Sat Jul 29 2000 - 00:00:00 CEST

Original text of this message