Search notes:

ORA-00984: column not allowed here

create or replace function tq84_fnc return number as begin
   return 42;
end tq84_fnc;
/
create table tq84_tab (num number, txt varchar(42));
Insert a record into tq84_tab:
insert into tq84_tab values(tq84_fnc, 'hello world');
drop function tq84_fnc;
tq84_fnc is not recognized as an identifier, Oracle throws ORA-00984: column not allowed here:
insert into tq84_tab values(tq84_fnc, 'hello world');
Cleaning up:
drop table tq84_tab;

SQLERRM and SQLCODE

The two «functions» sqlerrm and sqlcode cannot be used in SQL statements.
The insert statement in the exception handler throws an ORA-00984.
create table tq84_log(
   ts  timestamp default systimestamp,
   txt clob
);
 
declare
   num integer;
-- err varchar2(512);
begin
   select 0/0 into num from dual;
   insert into tq84_log(txt) values ('num = ' || num);
   commit;
  
exception when others then
   insert into tq84_log(txt) values ('error: ' || sqlerrm);
 
-- err := sqlerrm;
-- insert into tq84_log(txt) values ('error: ' || err);
 
   commit;
end;
/
If sqlerrm needs to be logged, it needs to be assigned to a variable first (as shown in the commented code above).

See also

This error message in a SQL model clause.
Other Oracle error messages

Index