# 22. Virtuoso Functions Guide - result

Chapter Contents | Prev | Next
Keyword Search:
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
Remote SQL Data Source
Replication
SOAP
SQL
__any_grants
close
collation_define
complete_table_name
delay
end_result
exec
exec_next
exec_result
exec_result_names
identity_value
name_part
registry_get
registry_get_all
registry_name_is_pro...
registry_remove
registry_set
result
result_names
row_count
sequence_get_all
sequence_next
sequence_remove
sequence_set
set_identity_column
set_row_count
set_user_id
signal
sinv_create_inverse
sinv_create_key_mapp...
sinv_drop_inverse
sys_stat_analyze
sys_stat_histogram
table_drop_policy
table_set_policy
username
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

## result

Sends one row of results to the calling client.
result (in col_1 any, .. , in col_n any);
Description

The result_names() predefines variables to be used in a result set to follow. The variables must be previously declared, from which the column data types are ascertained. This assigns the meta data but does not send any results. The result() function sends its parameters as a single row of results. These parameters should be compatible with those in the previous result_names(). The end_results() function can be used to separate multiple result sets. The result_names() can then be used to alter the structure of the next result set.

The result_names() call can be omitted if the application already knows what columns and their types are to be returned.

Parameters
col_1, ..., col_n – The data to be sent to the client.
Examples

This examples demonstrates outputting multiple result sets from a stored procedure. This procedure can be entered using ISQL but ISQL does not support multiple result sets. To view the output you can use the the sample application odbctest or another application supporting multiple result sets. The RES procedure, below, returns two result sets, the first with two rows and the second with four rows. The result_names function gives each result column a type and title. This can be omitted if the application knows which columns to expect. The result function sends the actual result row. The end_result function indicates that a new result set will begin. These functions can be used inside loops or subprocedures, thus allowing one call to yield a variable number of result sets.

    CREATE PROCEDURE RES (IN I INTEGER)
    {
      DECLARE STR, STR2 VARCHAR;

      RESULT_NAMES (I, STR);
      RESULT (I, 'FIRST');
      RESULT (I + 1, 'SECOND');
      RESULT_NAMES (I, STR, STR2);

      END_RESULT ();

      RESULT (I, 'FIRST');
      RESULT (I + 1, 'SECOND');
      RESULT (I + 2, 'THIRD', 'FF');
      RESULT (I + 3, 'FOURTH', 'FF');

      RETURN 1;
    }

See Also

result_names()

end_result()