Wednesday, August 05, 2009

ORA-04044: procedure, function, package, or type is not allowed here

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

This exception occurs when you specify a custom function (or packaged function as shown below) as default value for a table column.
create table test4044 (
code varchar2(10) default dbms_random.string('x',10));

Error at Command Line:2 Column:26
Error report:
SQL Error: ORA-04044: procedure, function, package, or type is not allowed here
The workaround is to create a BEFORE INSERT trigger:
create or replace
TRIGGER BI_test4044
before insert on test4044
for each row
begin
:new.code := dbms_random.string('x',10));
end;

See message translations for ORA-04044 and search additional resources.

No comments:

Post a Comment

I appreciate your comment however bear in mind that I might not have the time to reply soon.
Normally I do not reply to all comments but I am glad if you found something useful or if you learned something new, in that case I strongly encourage you to promote the article with the +1 google button.
Flavio