Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

INSTALL EXTERNAL OBJECT statement

Installs 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
[ AS USER user-name ]
environment-name : 
PERL
| PHP
| JS         
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 computer from where the object is being installed.

  • environment-name

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

  • AS USER clause

    Specifies the owner of the object.

Remarks

None.

Privileges

You must have the MANAGE ANY EXTERNAL OBJECT system privilege.

Side effects

None

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

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;