# 22. Virtuoso Functions Guide - identity_value

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

## identity_value

returns the last assigned identity column value
integer identity_value ();
Description

This function returns the value assigned to an identity column by the previous insert statement. Insert statements that do not assign identity columns do not affect this. Note that tables that have no primary key have n invisible identity column called _IDN. The scope is the connection. This function may be called from a client or from a stored procedure and will return the last given identity column value wherever it was given. The value stays set until overwritten by the next insert operation. This value is not set by rexecute or inserts to remote tables with autoincrement columns declared on the remote database since there is no standard way of getting this information from remote data sources.

The same value can be more efficiently accessed from clients using the SQLGetStmtOption ODBC call with the option SQL_GETLASTSERIAL. In this case the value is of type SQLINTEGER.

Return Types

The value assigned to an identity column by the previous insert or 0 if no identity column was assigned.