It might be in a different scope (for example, in a sub-block).
PL/SQL also supports dynamic SQL, which enables you to execute SQL data definition, data control, and session control statements dynamically.
In addition, PL/SQL conforms to the current ANSI/ISO SQL standard.
The following PL/SQ block runs two variations of the same query, first finding all the tables you can access, then all the indexes you can access: DECLARE CURSOR c1 IS SELECT object_name, status FROM user_objects WHERE object_type = 'TABLE' AND object_name NOT LIKE '%$%'; BEGIN FOR item IN c1 LOOP dbms_output.put_line('Table = ' || item.object_name || ', Status = ' || item.status); END LOOP; END; / list.
The select list might contain an expression, such as a column plus a constant, or two columns concatenated together.
You can optionally declare a return type for the cursor (such as The cursor is not a PL/SQL variable: you cannot assign values to a cursor or use it in an expression.item.object_name