Jump to content

Passing parameters OUT from Stored Procedures


This topic is 5305 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi

I am trying to get parameters OUT from a Stored Procedures running in MySQL backend.

My Stored Procedure is(In MySQL):)


CREATE PROCEDURE sp_grandtotal (IN orderid INT, OUT gtotal decimal(6,2))

SELECT SUM(quantity*unitprice) INTO gtotal

FROM OrderedProducts

WHERE _kf_OrderID=orderid





Now I am trying to run/call it from FMs Execute SQL Script as Calculated SQL text:





"SET @gtotal:=0.0;

call sp_grandtotal("&Orders::__kp_OrderID&",@gtotal);

Select @gtotal"

There are two problems:

Not sure about the syntex here in Calculated SQL text because its not running successfully though it runs in MySQL backend and how to capture the output variable and show on layout.

When I Run this ODBC Query log says:

-- Query logging

--

-- Driver name: MySQL ODBC 5.1 Driver Version: 05.01.0005

-- Timestamp: 091110 17:07:58

SET SQL_MODE='STRICT_ALL_TABLES';

SET @gtotal:=0.0; call sp_grandtotal(2,@gtotal); Select @gtotal;

And ODBC error in FM shows as the attachment

FM_ODBC_SQL.jpg

ODBC_Error_in_FM.JPG

Edited by Guest
Link to comment
Share on other sites

Generally, if you want a stored procedure to return stuff in to FileMaker, you should use "Import Records" in FileMaker, with the SQL statement that invokes the procedure specified as the query at the time of import.

Hope that points you a little way in the right direction.

James

Link to comment
Share on other sites

Thanks for your response.

I am now also considering the Import option from Script lets see how it goes.

Actually I was thinking to pass a parameter from FM and then execute that Stored Procedure and get the resulted value as parameter back to FM.

Link to comment
Share on other sites

This topic is 5305 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.