Create or replace function cv_rezie return number is
 cv messages.numcol2%type;
begin
insert into messages(numcol2,charcol2)
       values(seq_rezie.currval,'currval rezie je tady');
select numcol2 into cv from messages where charcol2='currval rezie je tady';
delete from messages where charcol2='currval rezie je tady';
return cv;
end;
/