由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - [转载] Hehe,不好意思,another question:)
相关主题
SQL run a stored procedure by fetching from a cursor row by row请教set和select 的区别
请问sql server里面怎么输出变量到文本文件?Need help on finding dependency objects
请帮忙读懂这个sql scriptquestion: copy first N rows from table B to table A (DB2)
can I create a recordset with cursor?How to merge tables in SQL Server 2000?
ORA-01002: fetch out of sequence问题求救,这个更新如何写?
A question of filling in missing value in SQL一个sql问题:怎样实现 (((a1*10)+a2)*10+a3)*10 ... (转载)
SQL query 一问get value returned by SQLstored procedure from python (转载)
谁能帮我看看这个oracle function有什么错?面试问题,关于oracle 8i
相关话题的讨论汇总
话题: fetch话题: row话题: hehe话题: cursor
进入Database版参与讨论
1 (共1页)
j*****g
发帖数: 223
1
【 以下文字转载自 Linux 讨论区 】
【 原文由 jinfeng 所发表 】
in mysql or postgresql i have vast amount of records (rows) in a table
WHAT I WANT:
each time fetch one record(row) back.
i vaguely know there exists something called "cursor," can any
big shrimp explain a little bit?
WHAT I DON'T WANT:
use select * from the table, then traverse the result row by row.
the table has too many rows, i guess using select * will hamper
the performance. tell me if my guess is wrong
//bow 100times! :)
D****N
发帖数: 430
2
BEGIN trTransaction; /* cursor only valid in transactions */
DECLARE curMyCursor CURSOR
FOR SELECT * FROM tMyTable;
FETCH FORWARD 1 IN curMyCursor; /* fetch first row */
FETCH NEXT IN curMyCursor; /* fetch next row */
/* and so on */
CLOSE curMyCursor;
COMMIT trTransaction;
See synopsis of FETCH statement for postgresql...
http://www.se.postgresql.org/docs/postgres/sql-fetch.htm
Don't think mysql has cursor (and transaction) functions :(

【在 j*****g 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 【 原文由 jinfeng 所发表 】
: in mysql or postgresql i have vast amount of records (rows) in a table
: WHAT I WANT:
: each time fetch one record(row) back.
: i vaguely know there exists something called "cursor," can any
: big shrimp explain a little bit?
: WHAT I DON'T WANT:
: use select * from the table, then traverse the result row by row.
: the table has too many rows, i guess using select * will hamper

1 (共1页)
进入Database版参与讨论
相关主题
面试问题,关于oracle 8iORA-01002: fetch out of sequence问题
老印给我的一个ChallengeA question of filling in missing value in SQL
sql面试题1SQL query 一问
用SSIS EXPORT 到 EXCEL 2010 有2000个COLUMN,可能吗谁能帮我看看这个oracle function有什么错?
SQL run a stored procedure by fetching from a cursor row by row请教set和select 的区别
请问sql server里面怎么输出变量到文本文件?Need help on finding dependency objects
请帮忙读懂这个sql scriptquestion: copy first N rows from table B to table A (DB2)
can I create a recordset with cursor?How to merge tables in SQL Server 2000?
相关话题的讨论汇总
话题: fetch话题: row话题: hehe话题: cursor