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