Sql Syntax Call Stored Procedure

Posted on 2007-10-10
Medium Priority
Last Modified: 2016-02-10
I have a table called 'capital' in mysql.  I am subtracting 10 from a field called 'pendingCapitalAvailable'.  To accomplish this, I am trying to use a stored procedure that I hope to call from Matlab.  I think this is sql syntax problem and not a matlab problem so read to the end pls.

When I try to execute it in matlab (using runStoredProcedure) it fails because I have an error in my 'sql syntax' .   The matlab command line is:

results = runstoredprocedure(conn, 'test5',{108})
'conn' is my database connection.

The error I get is the following:

java.sql.SQLException: [MySQL][ODBC 3.51 Driver][mysqld-5.0.18-nt-max]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{call test5(108)}' at line 1

 I am calling the procedure 'test5'  in the Matlab command line and i am not sure that it is the correct syntax when calling a stored procedure from an external program.  Any ideas?

The stored procedure & mysql version info is below.  Thanks


DROP PROCEDURE IF EXISTS `rt_20071001_ov03`.`test5` $$
CREATE PROCEDURE `test5`(in capitalUsed int)
  UPDATE capital
    SET pendingCapitalAvailable = pendingCapitalAvailable - capitalUsed;
END $$


Server info:
MySQL 5.0.45-community-nt via TCP/IP
MySQL Client Version 5.1.11
InnoDB tables
Question by:jmokrauer
  • 2
LVL 24

Expert Comment

ID: 20053827
I am not sure how to fix the problem, but I see the syntax error. Your program is sending the command

{call test5(108)}

to mysql. It should work correctly without the curly braces. Now.... how to remove them? I don't know. Might it be something to do with matlab?
LVL 24

Accepted Solution

mankowitz earned 1500 total points
ID: 20064620
What if you tried

results = runstoredprocedure(conn, 'test5',108)

Author Comment

ID: 20064656
if does not work, Matlab is expecting a cell....

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question