Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
stored procedures with out parameters

stored procedures with out parameters

2006-05-27       - By Nagesh Sharvari-A21337

 Back
Reply:     1     2     3  

Hello,
   I am using myodbc with unixODBC. I have downloaded myodbc for
solaris.
now, I am facing problems executing stored procedures with out
parameters.
I am using the example shown in stored procedure section of MySQL
reference manual :

CREATE PROCEDURE simpleproc (OUT param1 INT)

BEGIN

SELECT COUNT(*) INTO param1 FROM t;

END;

my C code to access stored procedure:

strcpy(stmt, "call simpleproc(?)") ;
rc = SQLPrepare(hstmt,stmt,SQL_NTS);  


and binding an integer parameter, id to the statment :


SQLINTEGER id;
rc= SQLBindParameter(hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_LONG,
SQL_INTEGER, 0, 0, &id, 0, NULL);
   
rc=SQLExecute(hstmt);
if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO))
{
  printf("Error in call to stored procedure %d\n",rc);
  SQLGetDiagRec(SQL_HANDLE_STMT, hstmt,1, stat,&err,msg,100,&mlen);
  printf("%s (%d)\n State : %s \n",msg,err, stat);
}



When I compile and run this program, I get the following error.

Connected !
Error in call to stored procedure -1
[MySQL][ODBC 3.51 Driver][mysqld-5 (See http://qld-5.ora-code.com).0.19-standard]OUT or INOUT argument 1
for routine test.simplepro (1414)
State : HYT00


Initially I thought State: HYT00, is something related to timeout. so
changed the statement attribute and changed the timeout period. but that
also doesn't help
I even tried the "?=call simpleproc()" but this gives syntax error.

I spoke to unixODBC people also, they are saying, the problem is in
myodbc.
so please help me.

thanks and regards
sharari