| |

VerySource

 Forgot password?
 Register
Search
View: 1304|Reply: 4

Ask a question about cursors

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-3-21 05:30:02
| Show all posts |Read mode
There is a problem that has been bothering me. Which hero helped me explain: Suppose I declare a cursor in the program to read the A table, and then write a loop statement to FETCH the cursor loop, and at this time another transaction keeps on A. Table INSERT new records, then can the newly inserted records be FETCH? How to determine the size of the result set that the cursor can handle?
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-8-14 14:30:01
| Show all posts
No, as long as there is no commit, it will not be read
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 16:00:01
| Show all posts
After the cursor is read, it should not be read when inserting into table A.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 16:15:01
| Show all posts
Just learn DB2, the problem is simple, please forgive me.
I want to ask why this stored procedure that returns a result set is wrong? (Built in the command editor)
create procedure getPeople
dynamic result sets 1
language sql
begin
declare rs1 cursor with return to client for
select name,age from test;
open rs1;
end

In addition, to test this stored procedure, do you only need to: call getpeople?
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 23:00:01
| Show all posts
The last stored procedure that returned the result set had no errors, but an error occurred when executed in the command editor, which can be executed in the Command Window. (A space and\should be added after each line, and\should not be added to the last line).
There is another question: how to upgrade the stored procedure? Do you use the drop procedure procedure name to delete one by one? In SQL, can multiple "drop procedure procedure names" be executed at once?

There is no mssql server and sybase, oracle convenient.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list