Comments - how can i transfer data use cursor

10 years, 8 months ago roberto spadim

well everything implemented about cursors at server side is here (from what i know):

http://dev.mysql.com/doc/refman/5.6/en/cursors.html

i understood that you is trying to implement a 'global' cursor, in other words, thread (connection) 1 create the cursor and 'save' it, thread (conneciton) 2 read this cursor value

well i don't know if mysql/mariadb cursors are 'global' (like tables) or if they only exists at procedure scope, but if they aren't i just see the table solution for your problem... create a table, and 'share' this table between server-side procedures, yes the table must be dropped / created in every interaction (INSERT/DELETE/UPDATE/ALTER add column/ALTER drop column)

maybe the best thing to do is send a oracle script example here, and try to rewrite it to mysql, this is better (faster) than trying to answer theory problems (not pratical problems)

 
10 years, 7 months ago bhdbing bhdbing

ok i will make a example for that: create table emp ( name varchar(20), age number(2), city varchar(20) );

 
10 years, 7 months ago bhdbing bhdbing

in oracle create a procedurue:

create or replace procedure find( rs out sys_refcursor) is begin

open rs for select * from emp;

end;

 
10 years, 7 months ago bhdbing bhdbing

execute this procedure in TOAD i can get the all info about my employees,and how to translate it to MariaDB?

 
10 years, 7 months ago roberto spadim

and what you want with procedure find? what you will do next? how other thread will read it in oracle?

i think this is a bit 'impossible' since in mariadb the rs variable is only to function scope, not to global scope... but must check

use pastebin to send examples of code, it's better than this wiki markup

http://pastebin.com/

 
10 years, 7 months ago bhdbing bhdbing

sorry i can't connect to that site.

may be you can send your email address to me.my email address is bhdbing@163.com.

in my current db,we use many cursor for transfer data.so if i must create temporary table,that will be a big trouble to me. could you give me some advice? Thank you!

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.