oracle中强ref_cursor和弱ref_cursor的区别
我想知道强引用光标和弱引用光标之间的实际区别。
强ref_cursor
将始终用于返回一个值,并且编译器在编译时知道该结构,但在弱ref_cursor
中它不会返回值,编译器也不会返回值在编译时了解结构。
这是基本的区别,但我的问题是强引用光标将返回什么值以及将在何处使用该返回值。
I want to know the practical difference between strong and weak ref cursor
.
Strong ref_cursor
will always use to return a value and compiler know the structure during the compile time, but in the weak ref cursor
it will not return a value and compiler dosen't know the structure during the compile time.
This is the basic difference but my question is what value will be returned by the strong ref cursor
and where that returned value will be used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
强类型引用游标始终返回已知类型,通常来自声明的 TYPE 对象。编译器可以通过将返回的类型与其使用方式进行比较来发现 PL/SQL 块中的问题。
弱类型引用游标的返回类型取决于它执行的 SQL 语句,即只有打开游标后类型才是已知的(在运行时)。编译器在运行之前无法确定类型,因此必须小心确保正确处理游标结果集以避免运行时错误。
A strongly typed ref cursor always returns a known type, usually from a declared TYPE object. The compiler can find problems in a PL/SQL block by comparing the types returned to how they are used.
A weakly typed ref cursor has a return type that is dependant on the SQL statement it executes, i.e. only once the cursor is opened is the type known (at runtime). The compiler cannot determine the types until it is ran, so care must be taken to ensure that the cursor result set is handled properly to avoid runtime errors.
强引用游标和弱引用游标之间还有一个区别,即强引用游标中不能进行动态查询,而弱引用游标中可以进行动态查询
there is one more difference between strong and weak reference cursor is that dynamic query is not possible in strong reference cursor where as it is possible in weak reference cursor