#

# LogiView

## Function 'db_function'

| This function executes the specified database function. A database function is - similar to a "stored procedure" - a database-specific and user-defined application function. If the database function has been executed successfully, 'db_function' returns a 0 and assigns the return value of the database function to the specified variable (VAR) (2nd argument). If the value cannot be converted to the variable type the execution is terminated by LogiView with an error message. If the database function is not processed correctly 'db_function' returns the database-specific return value. In this case the variable (VAR) is returned unchanged. Nonetheless, LogiView continues to process the current decision table/procedure.
| The LogiView function is currently only available for the Oracle database management system . Stored procedures must only contain input and output parameters of type string (for example 'VARCHAR2' in Oracle). All arguments of the parameter list are automatically converted to a string by LogiView.
| ### Syntax:
| {INT_VAR}= db_function ({STR_EXPR}, {VAR}, {EXPR_LIST})
| ### I/O parameters:
| {STR_EXPR} | Name of database function.
| {EXPR_LIST} | List of up to 8 arguments of arbitrary type. Arguments (expressions) must be separated by colons. Use LogiView variables if the corresponding argument of the database function are output parameters. Static values (i.e. strings in high colons or numerical values) should be used if the corresponding argument of the database function is an input-only parameter.
| {VAR} | Variable containing the return value of the database function.
| ### Return value:
| {INT_VAR} | This variable either contains a zero (0) value if the database function has been executed successfully or a specific database return value.
| ### Example:
| Declaration of Variables
    10 DOCU_INT_1 = db_function("my_own_db_prc", DOCU_STRING_1, user(),10)
    20 if (DOCU_INT_1 == 0)
    30  put (strprint("Result of 'my_own_db_prc' =%i", DOCU_STRING_1)
    40 else
    50  put (strprint("The 'my_own_db_prc' database function
                             returned Error code %i", DOCU_STRING_1)
    60 endif
| Functions and commands: DB / Mask Interface