www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
RDF data
Remote SQL Data Source
att_local_name
quote_dotted
rclose
rexecute
rmoreresults
rnext
rstmtexec
sql_columns
sql_config_data_sour...
sql_data_sources
sql_driver_connect
sql_get_installed_dr...
sql_get_private_prof...
sql_gettypeinfo
sql_primary_keys
sql_procedures
sql_remove_dsn_from_...
sql_special_columns
sql_statistics
sql_tables
sql_transact
sql_write_file_dsn
sql_write_private_pr...
vd_remote_data_sourc...
vd_remote_proc_wrapp...
vd_remote_table
vd_statistics
vdd_disconnect_data_...
vdd_measure_rpc_time
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY

Functions Index

rstmtexec

execute a SQL statement on a remote DSN, provides a result set where applicable.
rstmtexec (in dsn varchar, in stmt varchar, [in max_rows integer], [in params_array vector]);
Description

This function can be used to execute SQL on a remote data source directly. It returns a result set where one is expected.

This function is wrapper for the rexecute() provided for convenience as a shortcut.

Unless explicitly granted, only the DBA group is permitted to use the rstmtexec() to maintain security. Caution is required here since any user granted use of rstmtexec() has full control of the remote data source set-up by the DBA, albeit limited to the overall abilities of the remote user on the remote data source. Users can be granted and denied access to this function using the following commands:

GRANT REXECUTE ON '<attached_dsn_name>' TO <user_name>
REVOKE REXECUTE ON '<attached_dsn_name>' FROM <user_name>

This command directly affects the grant to the rexecute() function, which is the underlying mechanism for providing this function.

Parameters
dsn – The data source where the SQL statement should be executed. You must make sure that you have already defined the data source using the vd_remote_data_source function or by attaching tables from it.
stmt – the SQL statement to execute on the remote data source dsn.
max_rows – This controls the number of rows to be returned as follows:
  • negative - return no rows
  • zero (0) - all rows (default)
  • positive - specified number of rows
in_params – A vector of parameters to the statement if the executed statement has parameters. IN input parameters are specified as literals whereas OUT and INOUT parameters are specified as vectors of 3 elements for OUT and 4 elements for INOUT as follows:
  • [0] - the type of the parameter ('OUT' or 'INOUT')
  • [1] - the datatype that the parameter is bound to on the remote
  • [2] - the buffer length for the output parameter
  • [3] - (INOUT only) the input value of the parameter
Non-vector parameters in the in_params parameter of rstmtexec are considered IN parameters, so the rstmtexec remains backwards compatible.
Return Values

This function returns a result set.

See Also

rexecute(), rnext(), rmoreresults(), rclose()