NAME
ExtProc - Perl interface to the Oracle Perl External Procedure Library
SYNOPSIS
use ExtProc;
DESCRIPTION
The ExtProc module provides several functions that return useful data from an Oracle database connection. It is only useful from the Oracle Perl External Procedure Library, and requires DBI & DBD::Oracle.
FUNCTIONS
- database_name or DATABASE_NAME (exportable)
-
Returns the name of the database the client is connected to.
- user or USER (exportable)
-
Returns the username used to connect to Oracle.
- sessionid or SESSIONID (exportable)
-
Returns the session ID of the current connection
- exception(message)
-
Throws a user-defined Oracle exception. Note that the Perl subroutine will probably complete after this function is called, but no return values should be accepted by the calling client.
- context
-
Returns an OCIExtProcContext object for use with DBI->connect. When connecting to the database that called the external procedure, use the database name 'extproc', and supply no username or password. Pass the context returned by this function to the DBI->connect method by defining 'context' in the attributes parameter. Use the standard DBI method of connecting when using another database. An example follows:
use DBI; use ExtProc; # get the current OCI context my $context = ExtProc::context; # connect back to the calling database my $dbh = DBI->connect("dbi:Oracle:extproc", "", "", { 'context' => $ctx });
NOTE: External procedures are stateless, so there is no concept of a persistent connection to the database. Therefore, you must run the DBI->connect method before each query. This may be automated in the future.
AUTHOR
Jeff Horwitz <jeff@smashing.org>
SEE ALSO
perl(1), perlembed(1), DBI(3), DBD::Oracle(3)