what is the datatype of a %isopen attribute?

by sathish
(hyderabad)

what is the datatype of a %isopen attribute?


The answer to this is perhaps not as obvious as it might seem. "%ISOPEN" is one of the cursor attributes - the others being "%FOUND", "%NOTFOUND", and "%ROWCOUNT". All cursors, whether explicit or implicit, have these attributes but you can only access them in PL/SQL.

To answer the question, "%ISOPEN" is a BOOLEAN the same as "%FOUND" and "%NOTFOUND". However, remember that in PL/SQL the BOOLEAN data type has 3 values - true, false and NULL (undefined). Whilst "%ISOPEN" is never NULL, "%FOUND" and "%NOTFOUND" may be NULL depending on whether or not the cursor is open.

The following table shows the values of these cursor attributes for the state of the cursor.
                                
cursor                     cursor attribute  
state             %ISOPEN  %FOUND    %NOTFOUND  %ROWCOUNT

Before OPEN      FALSE    exception  exception  exception


After OPEN       TRUE     NULL       NULL            0


After FETCH      TRUE     TRUE       FALSE          >=1


After last FETCH TRUE     FALSE      TRUE           >=1


After CLOSE      FALSE    exception  exception  exception

Click here to post comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Oracle Questions.