A cursor doesn't store results, it's really a pointer to let you iterate over the results (as @Ted shows in action). If you want to store the results within your PL/SQL block then you can use a collection, which you can declare as a type matching your table to be close to your single-row query into a record type; and then bulk-collect into that:
declare
type t_tab is table of mytable%ROWTYPE;
v_tab t_tab;
v_c pls_integer := 0;
begin
select *
bulk collect into v_tab
from mytable
where col1='20190103';
for i in 1..v_tab.count loop
if v_tab(i).col2 = 'Y' then -- whatever you need to test
v_c := v_c + 1;
end if;
end loop;
dbms_output.put_line(v_c);
end;
/
But unless you're doing something else with both the rows that match and those that don't match your condition, you could just add that as a test in the main query:
declare
type t_tab is table of mytable%ROWTYPE;
v_tab t_tab;
v_c pls_integer := 0;
begin
select *
bulk collect into v_tab
from mytable
where col1='20190103'
and col2='Y'; -- whatever you need to test
for i in 1..v_tab.count loop
v_c := v_c + 1;
end loop;
dbms_output.put_line(v_c);
end;
/
If you're only counting the matching rows then you don't need a cursor or a collection, just use the aggregate function:
declare
v_c pls_integer;
begin
select count(*)
into v_c
from mytable
where col1='20190103'
and col2='Y'; -- whatever you need to test
dbms_output.put_line(v_c);
end;
/
or don't use PL/SQL at all:
select count(*)
from mytable
where col1='20190103'
and col2='Y'; -- whatever you need to test
Incidentally, your '20190103'
value looks like you're storing a date as a string. You should use the correct data type - store dates as actual dates. (And if the column is a date then you're relying on implicit conversion, which is also not a good idea...)