#
#
# This is an example of how we could code a JAPH in Oraperl.
#
# Author:	Kevin Stock
# Date:		1st December 1992

eval 'use Oraperl; 1' || die $@ if $] >= 5;

# supply debugging output if desired

$ora_debug = shift if $ARGV[0] =~ /^-#/;

# login to the database and create the table

$lda = &ora_login('t', 'kstock', 'kstock') || die $ora_errstr;
&ora_do($lda, <<) || die $ora_errstr;
	create table japh (word char(7), posn number(1))

# Loop to insert data into the table

$csr = &ora_open($lda, <<) || die $ora_errstr;
	insert into japh values(:1, :2)

while (<DATA>)
{
	chop;
	&ora_bind($csr, split(':')) || warn "$_: $ora_errstr";
}
&ora_close($csr) || warn $ora_errstr;

# Now retrieve the data, printing it word by word

$csr = &ora_open($lda, <<) || die $ora_errstr;
	select word from japh order by posn

while (($word) = &ora_fetch($csr))
{
	print "$word ";
}
&ora_close($csr) || warn $ora_errstr;

print "\n";

# delete the table

&ora_do($lda, 'drop table japh') || warn $ora_errstr;
&ora_logoff($lda) || die $ora_errstr;

__END__
Oraperl:3
another:2
hacker:4
just:1
