Example: Parameters and Stored Procedures

Learn how to create a mobile business object (MBO) from a stored procedure that contains parameters.

This example creates a stored procedure with two parameters in the sampledb that serves as a customer address book. Passing in the first and last names returns address information. For example, you can use SQL Scrapbook to create a stored procedure using this statement:
create PROCEDURE dba.getCustomerAddress 
	(@lname_parm varchar(15), @fname_parm varchar(15)) 
AS 
BEGIN
	select address, 
	city, 
	state,
	zip
	from customer 
	where lname = @lname_parm and fname = @fname_parm
END

Create an MBO from the stored procedure. For example, drag and drop the getCustomerAddress stored procedure onto the Mobile Application Diagram. The SQL query for this statement, which calls two parameters is:

{CALL sampledb.dba.getCustomerAddress(:lname_parm,:fname_parm)}

which are the default load parameters.