'select * from [table

编程入门 行业动态 更新时间:2024-10-24 08:28:07
'select * from [table_name]'是秘密的游标?('select * from [table_name]' is secretly a cursor?)

几天前,在采访中,我被问到select * from [table_name]中的select * from [table_name]是否是一个游标,因为它一次获取多条记录?

如果是,那么哪种类型? 显式还是隐式 ,为什么?

请,如果有人能详细说明这将是一个很大的帮助。

A few days back I was asked during an interview if select * from [table_name] is a cursor since it fetches a number of records at a time?

If yes then of which type? Explicit or Implicit and why ?

Please, if anyone can elaborate on this it would be a great help.

最满意答案

显式游标是那些明确打开,提取数据,关闭的游标。

如上所述,光标的使用有两个部分:

游标的定义 游标的用法

游标的定义可以是

CURSOR c IS SELECT col1,col2 FROM table_name

要么

对于我IN(选择col1,col2 FROM table_name)

接下来的区别是:

显式游标需要

打开,取出,退出时,关闭

隐式游标在FOR LOOP语句中执行上述所有步骤。

总而言之,SELECT语句是一个隐式游标。

Best,Mikcutu。

The explicit cursors are those whcih explicitly are opened, fetched data, closed.

As stated, the usage of cursor have 2 parts:

definition of the cursor usage of cursor

Definition of the cursor can be as

CURSOR c IS SELECT col1, col2 FROM table_name

or

FOR i IN (SELECT col1, col2 FROM table_name)

The differences comes next:

The explicit cursor needs

OPEN, FETCH, EXIT WHEN, CLOSE

The implicit cursor performs all above steps in the FOR LOOP statement.

Concluding, a SELECT statement is an implicit cursor.

Best, Mikcutu.

更多推荐

本文发布于:2023-04-29 12:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336295.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:select   table

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!