** Another Challenge **
Posted in 1995
This one definitely got me for a second.
Run this through your debugger and print 'c' in each case. Tell me
you would expect the second count(*) to print '2'. Wrong!!
E-Mail if you want the answer.
----------------------------------------------------------------------------
database fred
define c smallint
main
begin work
call create_temp_table()
insert into t_fred
values(1)
select count(*) into c from t_fred
call create_temp_table()
insert into t_fred
values(1)
insert into t_fred
values(1)
select count(*) into c from t_fred
commit work
end main
----------------------------------------------------------------------------
function create_temp_table()
whenever error continue
drop table t_audit
create temp table t_fred
(
fred smallint
)
whenever error stop
end function # create_temp_table()
----------------------------------------------------------------------------