# 22. Virtuoso Functions Guide - complete_table_name

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

## complete_table_name

Returns a fully qualified table name.
varchar complete_table_name (in tablename varchar, in mode integer);
Description

The complete_table_name() can be used to make a fully qualified table name from non-qualified one, i.e. the qualifier and owner will be added if they are missing.

Parameters
tablename – The table name to be retrieved.
mode – If this mode parameter is set to 1 this function will first look-up the supplied tablename for a match in the system tables. If a match is found the full name will be returned, if the table is not found the function will continue as if the mode were set to 0. When the mode parameter is 0 the result will be generated using the current qualifier and current SQL user account names.
Return Types

A string will be returned containing the fully qualified table name.

Errors

SQLState | Error Code | Error Text | Description
--- | --- | --- | ---
22023 | SR014 | Function complete_table_name needs a string as argument 1, not an arg of type [type] |
22023 | SR008 | Function complete_table_name needs an integer as argument 2, not an arg of type [type] |

Examples
Using the complete_table_name() function

This simple example shows retrieval of a fully qualified table name using the complete_table_name() function from ISQL. In the first case the table name supplied is a system table, in the second case the table does not exist and the result is generated based on the users details:

    SQL> use WS;

    Done. -- 4 msec.
    SQL> select complete_table_name('SYS_DAV_RES', 1);
    callret
    VARCHAR
    _______________________________________________________________________________

    WS.WS.SYS_DAV_RES

    1 Rows. -- 1 msec.

    SQL> select complete_table_name('SYS_DAV_RES__', 1);
    callret
    VARCHAR
    _______________________________________________________________________________

    WS.DBA.SYS_DAV_RES__

    1 Rows. -- 1 msec.