Finally figured out how to call Oracle stored procedure and function from Servoy. (See attachment if interested).
Now i would like to fill an extra non-database field in the form(tableview) with the output of a function
So for each record displayed, an extra field has to be filled from the function. the prim.key of the table is input for the function.
I use this very often in Oracle Forms, its flexible and it’s fast because the server does the work and the client only display’s the result.
I got it working by creating a view where one of the columns is the function. Now i can create a relation from the forms base table to this view
and then i can create a calculated field which returns .<function_column>
I am not sure that this is the way to do this in Servoy.
Version info :
Version 3.5 rc2-build 507
Java version 1.6.0_01-b06 (Windows XP)
Database Oracle 10Gr2
biskpi is the name of the Oracle schema that owns the procedure get_rap_dat_tot.
@Christian :
I suppose this may work in Oracle also.
I know it works for functions, but i am not sure about procedures
Will try it and if succesfull, i will post a reply here.
Thanks.
A couple of month’s ago I had the same sort of problem.
This is a copy of my reply on the Servoy forum:
Problem solved, here is the script with an Oracle stored function. Solution found by studing Oralce jdbc documentation on the subject and by trial and error.
var args = new Array() ;
args[0] = java.sql.Types.VARCHAR ;
var typesArray = new Array() ;
typesArray[0] = 1; // output
var nieuwAanvraagNR = ‘0222.01’ ;
var function_declaration = “{ ?=call bvg.bvg_get_next_aanvraagnr() }” ;
//var function_declaration = “begin ? := bvg.bvg_get_next_aanvraagnr(); end;” ;
var dmesp = databaseManager.executeStoredProcedure(controller.getServerName(), function_declaration, args, typesArray,1) ;
nieuwAanvraagNR = dmesp.getValue(1,1) ;
Conclusion: the Reference Guide on this method .executeStoredProcedure is in my humble opinion not correct in the example procedure_declaration and on the typeArray values.