10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Calling ProceduresThe syntax for calling a database procedure is:[integer_variable = ] callproc procedurename[(parameter = expression{, parameter = expression})]procedurenameSpecifies the name you specified when you created the database procedureand that you later provided when you registered the database procedure inOpenROAD Workbench.In the following example, the callproc statement calls the database procedurenamed mydbprocedure:callproc mydbprocedure;How You Can Pass Parameters to and From Database ProceduresYou use parameter names to pass parameters to database procedures just asyou do with 4GL procedures. You can pass the parameters in any order. Fordatabase procedures, the parameters must be simple variables only.In the following example, intparam, floatparam, and charparam are integer,float, and varchar variables, respectively:returnvalue = callproc mydbprocedure(intparam = 256,floatparam = 3.625,charparam = 'seen any good movies lately');When the procedure returns a value, you must specify an integer variable inthe calling frame or procedure to receive the return value, for example:returnvalue = integer;How You Can Call Procedures in ExpressionsIf a procedure returns a value, you can use the procedure as an expression oras part of an expression in an OpenROAD statement. The data type of thereturn value must be compatible with the requirements of the expression.To call a procedure as part of an expression, do not use the callproc keyword.Simply give the procedure name followed by the parameter list. In thefollowing example from the check_out frame script, the expression in the ifstatement calls the error_handler procedure:if error_handler(frm = CurFrame, commit_evt ='Commit') != ER_OK thenresume;endif;86 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!