几天前,在采访中,我被问到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 cursorDefinition 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 needsThe implicit cursor performs all above steps in the FOR LOOP statement.OPEN, FETCH, EXIT WHEN, CLOSE
Concluding, a SELECT statement is an implicit cursor.
Best, Mikcutu.
更多推荐
发布评论