#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    3
    Rep Power
    0

    Pass parameter as cursor type into procedure in MySQL


    Hi all,

    I have a procedure that i want to pass a parameter as CURSOR type but i dont.

    Ex: Create Procedure ABC(OUT p_cursor CURSOR)
    Begin

    End$$

    Pls help me to do this.

    Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Location
    Italy
    Posts
    36
    Rep Power
    2
    No you can't pass cursors as parameters.

    What goal are you trying to achieve? Maybe I know a workaround.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    3
    Rep Power
    0
    Thanks for your reply,

    I just want to take some values that return over cursor and These values i'll use in my java program for purposes.

    If you have any ideas or resolves, i want to know about it.

    Thuan.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Location
    Italy
    Posts
    36
    Rep Power
    2
    Sorry, in MySQL Cursors only exist within Stored Procedure and they can't even be returned to another procedure.

    I hope that this solution is acceptable:
    * the procedure creates a view
    * the applicazion queries that view.

    Since views are always global (all users can access them), the view should have a name like:
    CONCAT('my_view', CONNECTION_ID());
    and you should DROP it (or use CREATE OR REPLACE VIEW).

    I hope this helps.

IMN logo majestic logo threadwatch logo seochat tools logo