INSTALL EXTERNAL OBJECT statement

Use this statement to install an object that can be run in an external environment.

Syntax
INSTALL EXTERNAL OBJECT object-name 
[ update-mode ] 
FROM { FILE file-path | VALUE expression }
ENVIRONMENT environment-name
environment-name : 
PERL
| PHP
update-mode : 
NEW 
| UPDATE
Parameters
  • object-name   The name by which the installed object will be identified within the database.

  • update-mode   The update mode for the object. If the update mode is omitted, then NEW is assumed.

  • file-path   The location on the server machine from where the object is being installed.

  • environment-name   The name of the external environment in which the external object is run.

Remarks

For more information on external environments, see Overview of external environments.

Permissions

Must have DBA authority.

Side effects

None

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Examples

In this example, you install a Perl script that is located in a file into the database.

INSTALL EXTERNAL OBJECT 'PerlScript' 
NEW 
FROM FILE 'perlfile.pl'
ENVIRONMENT PERL;

Perl code also can be built and installed from an expression, as follows:

INSTALL EXTERNAL OBJECT 'PerlConsoleExample'
NEW
FROM VALUE 'sub WriteToServerConsole { print $sa_output_handle $_[0]; }'
ENVIRONMENT PERL;

Perl code also can be built and installed from a variable, as follows:

CREATE VARIABLE PerlVariable LONG VARCHAR;
SET PerlVariable = 
  'sub WriteToServerConsole { print $sa_output_handle $_[0]; }';

INSTALL EXTERNAL OBJECT 'PerlConsoleExample' 
NEW 
FROM VALUE PerlVariable
ENVIRONMENT PERL;