To ensure the output from your dbms_output calls are shown, enable serveroutput in SQL*Plus:
...
v_end_id=$(sqlplus -s ${db_str} <<-EOS
set serveroutput on
DECLARE
...
A few other points:
- There's no need for quotes around $v_batch_size in the PL/SQL block
- Also, this variable isn't set! The one that is is batch_size
- The script will fetch all rows from the query. If you just wan the first of these, batch, remove the loop.
- If the query returns less than batch_size rows, this will return nothing!
If you always want to see the last row, replace:
v_created := l_created_dates($v_batch_size);
with:
v_created := l_created_dates(l_created_dates.last);