Results 1 to 2 of 2

Thread: return result set in SPs

  1. #1
    Join Date
    Jul 2005
    Posts
    35

    Unhappy return result set in SPs

    hi all,
    how can we have a select satement in an SP?(i want to return a result set from the SP). i want to migrate from SQL Server to MySQL and i don't know what to do with these SPs.
    it can be done in MySQL client, but it gives the error:"procedure foo can't return a result set in the given context MySQL"
    in the application.
    can i set a cursor out put parameter and return it?(just like Oracle) or it has another solution?

    and another question: is MyODBC 3.51 tested with MySQL 5.x? can we call an SP from Delphi via MyODBC? (i tried to do so (using ADO an a data provider for OLEDB) but i think somewhere in passing the call statement it had put {} around "call sp()" statement so that mysql returned an error about the syntax.)



    Thanks in advane
    Chagh

  2. #2
    Join Date
    Sep 2005
    Posts
    5
    while connecting to Mysql you need to give the parameter CLIENT_MULTI_RESULTS,


    mysql_real_connect ( &mysql,"192.168.1.4", "root", "root",NULL,
    3310, NULL, CLIENT_MULTI_RESULTS );


    Once you executes a query like, call sp_name(), it may return multiple resultset, you can extract these results as follows,
    do{
    ...
    result = mysql_store_result ( &mysql );
    ...
    } while ( mysql_next_result ( &mysql ) <= 0 );

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •