I’m using Coldfusion8 and trying to get a simple stored procedure to run a MySQL id-lookup.
When I fire the procedure from inside MySQL it’s working. However on my Coldfusion page, nothing happens.
Here is my procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_select_extern`(IN `iln_to_match` VARCHAR(13))
LANGUAGE SQL
NOT DETERMINISTIC
READS SQL DATA
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SELECT tn.iln
FROM teilnehmer AS tn
WHERE tn.iln = iln_to_match
LIMIT 1;
END
And my procedure call in Coldfusion:
<cfstoredproc procedure="proc_select_extern" datasource="dns">
<cfprocparam type="in" value="#Session.Extern#" cfsqltype="cf_sql_varchar" maxlength="13">
<cfprocresult name="extern">
</cfstoredproc>
<cfoutput query="extern">
<p>Hello #extern.username#</p>
</cfoutput>
I thought I would at least get a CALL proc_select_extern(‘value’); report in MySQL, but I’m not even getting this.
EDIT:
So I got it to work on a empty page as a CFQUERY like so:
<cfquery datasource="db" NAME="extern">
SELECT tn.iln
FROM teilnehmer AS tn
WHERE tn.iln = #Session.Extern#
LIMIT 1
</cfquery>
<cfdump var="#extern#">
<cfoutput>#IsDebugMode()#</cfoutput>
Trying the same with a storedProc now.
Is there some form of ColdFusion error message? Also, if you have debugging enabled on the request do you see the procedure call being made there?
Also, just an observation. The SQL in your stored procedure is very basic (single table select with no join). Having this be a stored procedure will create more sql overhead than an inline query. There will be no performance gain from using a stored procedure.