1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
122 views
by brandon-w-8204 (34.1k points)
I need to call a stored procedure using a parameterized query.

1 Answer

0 votes

Here is some example code you can use:

// Create the pQuery object with the stored procedure to be called
var pQuery = qie.getParameterizedQuery("CALL GetImmediateManager(:employeeId, :managerIdOut)");

// Set the values for the input parameters
pQuery.setInt("employeeId", 7);

// Register the output parameters
pQuery.registerOutputInt("managerIdOut");

// Execute the stored procedure
var queryResult = pQuery.doQuery("mariadb");

// Get the value from the registered output parameter
qie.debug(pQuery.getOutputParameter('managerIdOut'))

Another Example:

// Create the pQuery object with the stored procedure to be called
var pQuery = qie.getParameterizedQuery("call get_employee_age(:employeeId)");

// Set the values for the input parameters
pQuery.setInt("employeeId", 17);

// Execute the stored procedure
var queryResult = pQuery.callStoredProcedure("mariadb");

qie.debug(queryResult[0].getNode("/"));

by brandon-w-8204 (34.1k points)
...