Difference between strong ref cursor and weak ref cursor.
Difference:
Strong
ref cursor |
Weak ref
cursor |
· It will always return the value. |
It will not always return the value. |
·
Compiler know the structure during the compile
time. |
Compiler does not know the structure during
the compile time. |
·
Dynamic query is not possible. |
Dynamic query is possible. |
·
It will always return the know type from usually
the declared type object. |
It has return type which is dependent on the SQL
statement which executes only once the cursor is opened is the type known at
the runtime. |
·
Compiler can figure out or determine or find
out the problem in the PLSQL block by comparing the types returned to and how
they are used. |
Compiler cannot determine the type until it is
run. Cursor result set should be cared and handled properly to avoid runtime
errors. |
·
It is used with select statement that return
the result whose data type matches with the one that you have fixed during
the STRONG REF cursor declaration. |
It is mostly used with REF cursor which is
open for all select statements. |
·
Syntax: Declare TYPE ref_cur_name IS REF CURSOR RETURN return_type; |
Syntax: Declare TYPE ref_cur_name is REF CURSOR |
·
It is also called as the static structure
type. |
It is also called as the dynamic structure
type. |
·
If return type is specified,REF Cursor type
and cursor variable are strong. |
If return type is specified, REF Cursor type
and cursor variable are strong. |
·
Cursor structure is predetermined. Query cannot be done by using emp%rowtype. |
Cursor structure is not predetermined. Query can be done by using any structure. |
·
It is less error prone. |
It is more error prone. |
Comments
Post a Comment