The primary difference between a normal cursor and a ref cursor lies in when and how the query is defined:
Normal Cursor: The query is predefined and static, and it's defined at the time of declaration in the PL/SQL block. The query remains fixed and cannot be altered during runtime.
Ref Cursor: The query is dynamic and can be defined at runtime using the OPEN statement. The query is assigned when you actually open the ref cursor, allowing you to change the query based on runtime conditions.
In summary, normal cursors have a fixed query declared at compile-time, while ref cursors allow you to define the query dynamically at runtime when the cursor is opened.
Top comments (0)