create table test_t (col1 varchar2(10), col2 TIMESTAMP(0) WITH TIME ZONE)
Table created.
insert into test_t values(3, to_timestamp_tz('2021-04-28 09:40:00 PM -5:00','yyyy-mm-dd hh:mi:ss AM TZH:TZM'))
1 row(s) inserted.
insert into test_t values(4, to_timestamp_tz('2021-04-28 09:40:00 PM US/Central','yyyy-mm-dd hh:mi:ss AM TZR'))
1 row(s) inserted.
commit
Statement processed.
select * from test_t
COL1 | COL2 | 3 | 28-APR-21 09.40.00.000000 PM -05:00 | 4 | 28-APR-21 09.40.00.000000 PM US/CENTRAL |
---|
declare
cursor c1 is
select col1, col2 from test_t;
r1 c1%rowtype;
begin
open c1;
loop
fetch c1 into r1;
exit when c1%notfound;
if r1.col2 < systimestamp then
dbms_output.put_line('hi1');
dbms_output.put_line(r1.col1);
else
dbms_output.put_line('hi2');
dbms_output.put_line(r1.col1);
end if;
end loop;
close c1;
end;
Statement processed.
hi2
3
hi2
4
declare
cursor c1 is
select col1, col2 from test_t;
r1 c1%rowtype;
begin
open c1;
loop
fetch c1 into r1;
exit when c1%notfound;
if r1.col2 < systimestamp then
dbms_output.put_line('hi1');
dbms_output.put_line(r1.col1);
else
dbms_output.put_line('hi2');
dbms_output.put_line(r1.col1);
end if;
end loop;
close c1;
end;
Statement processed.
hi2
3
hi2
4
declare
cursor c1 is
select col1, col2 from test_t;
r1 c1%rowtype;
begin
open c1;
loop
fetch c1 into r1;
exit when c1%notfound;
if r1.col2 < systimestamp then
dbms_output.put_line('hi1');
dbms_output.put_line(r1.col1);
else
dbms_output.put_line('hi2');
dbms_output.put_line(r1.col1);
end if;
end loop;
close c1;
end;
Statement processed.
hi2
3
hi2
4
declare
cursor c1 is
select col1, col2 from test_t;
r1 c1%rowtype;
begin
open c1;
loop
fetch c1 into r1;
exit when c1%notfound;
if r1.col2 < systimestamp then
dbms_output.put_line('hi1');
dbms_output.put_line(r1.col1);
else
dbms_output.put_line('hi2');
dbms_output.put_line(r1.col1);
end if;
end loop;
close c1;
end;
Statement processed.
hi2
3
hi2
4