You can call the Java stored functions/procedures by using a CALL statement, from SQL statements or Java applications.
The following shows how to call them by using the CALL statement. The name of the Java stored function/procedure called from a CALL statement is not case sensitive.
CALL {procedure_name ([param[, param]...) | function_name ([param[, param]...) INTO :host_variable
param {literal | :host_variable}
call Hello() into :HELLO;
call Sp_int(3) into :i;
call phone_info('Tom','016-111-1111');
In CUBRID, the Java functions/procedures are called by using the same CALL statement. Therefore, the CALL statement is processed as follows:
The following error occurs if you call a Java stored function/procedure that does not exist.
CALL deposit()
ERROR: Stored procedure/function 'deposit' is not exist.
CALL deposit('Tom', 3000000)
ERROR: Methods require an object as their target.
If there is no argument in the CALL statement, a message "ERROR: Stored procedure/function 'deposit' is not exist." appears because it can be distinguished from a method. However, if there is an argument in the CALL statement, a message "ERROR: Methods require an object as their target." appears because it cannot be distinguished from a method.
If the CALL statement is nested within another CALL statement calling a Java stored function/procedure, or if a subquery is used in calling the Java function/procedure, the CALL statement is not executed.
call phone_info('Tom', call sp_int(999));
call phone_info((select * from Phone where id='Tom'));
If an exception occurs during the execution of a Java stored function/procedure, the exception is logged and stored in the dbname_java.log file. To display the exception on the screen, change a handler value of the $CUBRID/java/logging.properties file to " java.lang.logging.ConsoleHandler." Then, the exception details are displayed on the screen.