Thursday, October 24, 2013

Call Stored Procedure in ColdFusion by using CFQUERY



Yes we can call stored procedures by using <cfquery>  tag. Below code depicts how to call a my SQL stored procedure by using <cfquery>.



<cfquery datasource="ebms" name="k">
CALL ebmsSP_getOptedOutEmployeeList
(
<cfqueryparam value="1" cfsqltype="cf_sql_integer" >,
<cfqueryparam value="1" cfsqltype="cf_sql_integer" >,
<cfqueryparam value="Y" cfsqltype="cf_sql_char">
);
</cfquery>

2 comments:

  1. What if you need to return a value? How do you get that in return?

    ReplyDelete
  2. the value would be in a variable indicated by the name attribute of the cfquery tag (just like any normal cfquery call)

    ReplyDelete