[comp.lang.perl] ORAPERL - Perl access to Oracle databases

kstock@isfrance.encore.fr (Kevin Stock,MIS,346,) (04/15/91)

[ Please let me know if you see this - I've had trouble posting it ]

I have just sent to comp.sources.misc a set of usersubs to enable Perl
programs to access Oracle databases. To use it, you will need a version
of Perl which accepts usersubs (3.0.27 or higher) and the Oracle Pro*C
product.

It has been tested with Perl v3 and v4 and with Oracle v6 (but should work
on v5, and maybe on earlier versions as well).

A sample of how you could produce a listing of your telephone directory:

	format top =
	       Name                           Phone
	       ====                           =====
	.

	format STDOUT =
	       @<<<<<<<<<<              @>>>>>>>>>>
	       $name,                   $phone
	.

	die ("You should use oraperl, not perl\n") unless defined &ora_login;

	$lda = &ora_login("t", "kstock", "password")
		|| die $ora_errstr;
	$csr = &ora_open($lda, "select * from telno order by name")
		|| die $ora_errstr;

	while (($name, $phone) = &ora_fetch($csr))
	{
		write;
	}

	do ora_close($csr) || die "can't close cursor";
	do ora_logoff($lda) || die "can't log off Oracle";

I'd appreciate any comments, bug reports etc. If you find it useful, please let
me know what you're doing with it.

perl -e 'print "Just another Perl hacker-wannabe :-)"'

  ,---------------.
,-+-------------. |    Kevin Stock
| | E N C O R E | |
| `-------------+-'    kstock@gouldfr.encore.fr
`---------------'      kstock@gouldfr.UUCP

Any opinions expressed are my own, but may be reproduced under the terms
of the GNU licence. See the file COPYING at the end of this posting. :-)