Hello Everybody
I need to call a dbprocedure with iReport5.5 to get a new Barcode from an "SAP MaxDb" database.
No success :-(
This is the definition for the database:
CREATE DBPROC SERVOY_AUTONUM (IN SUCHKEY CHAR(30),OUT NEUERWERT FIXED(10,0)) AS
BEGIN
SELECT WERT INTO :neuerwert FROM "BWALLE"."AUTONUM" WHERE SUCHBEGRIFF =:suchkey WITH LOCK EXCLUSIVE;
IF $RC = 0 THEN
BEGIN
UPDATE "BWALLE"."AUTONUM" SET WERT = WERT + 1 WHERE SUCHBEGRIFF = :suchkey ;
SET NEUERWERT = NEUERWERT + 1;
END
ELSE
SET NEUERWERT = - 1;
END;
The procedure returns just a new mumber!
From Visual Foxpro we call it like this:
l_suchbegriff = "TEST"
neuerwert = 0
CALL SERVOY_AUTONUM(?l_autosucher,?@neuerwert) WITH COMMIT
From SQL Studio we call it like this:
call SERVOY_AUTONUM ('TEST',?) with commit
From our web development tool we call it like this:
var suchbegriff = "TEST"
function g_autonum('suchbegriff) {
// wir rufen die datenbank procedure servoy autonum mit einem Suchbegriff
var procedure_declaration = "{CALL BWALLE.SERVOY_AUTONUM(?,?)}"
var args = [suchbegriff, java.sql.Types.NUMERIC];
var argTypes = [0, 1]; //0 = input 1 = output
try {
var dataset = plugins.rawSQL.executeStoredProcedure('maxdb', procedure_declaration, args, argTypes, 1);
if (plugins.rawSQL.getException()) {
...
}
} catch (e) {
application.output(e);
}
var v_neueid = dataset.getValue(1, 1);
return v_ergebnis;
}
Until now i found now way to call this procedure from IReport.
following the examples I tried:
call BWALLE.SERVOY_AUTONUM($P{Suchbegriff}, $P{ResultSet})
and got a error message:
SQL-Statement would generate a row count ???
Did someone ever called a maxdb procedure from IReport? (Example?)
Any help welcomed.
Best regards
Albert