A cursor expression is equivalent to a ref cursor. An explicit cursor is a different and not interchangeable; you can do some swapping between ref cursors and cursor variables with the dbms_sql
package but not with an explicit cursor like this.
The closest I can see to what you seem to want is to have a cursor variable that opens the same query with the `open for syntax:
procedure test is
v_ct pls_integer;
main_cur t_cursor;
begin
open main_cur for select 1 from dual;
select count(*) into v_ct from table(test_pipe(main_cur));
close main_cur;
dbms_output.put_line('Count is: ' || v_ct);
--some code
end test;
But that isn't quite the same thing, so might not be suitable. I'm not sure why you would want to do anything with an explicit cursor other than loop over it though.
Straying into XY territory here as this is nothing to do with what you originally asked, but from comments you seem to want to be able to aggregate the data in the cursor; you could do that with an analytic count instead. As a very simple example, if your cursor query was doing:
select trace, col1
from t42
order by trace, col1;
then you could add another column that counts each trace value:
select trace, col1,
count(col1) over (partition by trace) as trace_count
from t42
order by trace, col1;
You could then refer to column in your cursor loop. Or if you wanted to only loop over the rows where the count is one, your cursor could use that as a subquery:
select trace, col1
from (
select trace, col1,
count(col1) over (partition by trace) as trace_count
from t42
)
where trace_count = 1
order by trace, col1;
SQL Fiddle demo.