Not null constraint problem in creating a view
576659May 11 2007 — edited May 11 2007Hi all
I have created a function called mask. the function goes like this
Create or replace function mask(val varchar2) return varchar2 is
begin
return 'HI';
end;
After creating this function i tried creating a VIEW.
Create view empsample as select empno,mask(ename) from emp;
I have masked all the names to 'HI'.
After this i have described the view. actually the ename variable size is 20. but after creating the VIEW , the datatype size is 4000.
i know the reason for this.. the function which i called in creating the table returns varchar2 and in turn 4000 got updated.I have used CAST function for this problem. and now in the original table there is a NOT NULL constraint for the ename column but in the VIEW created i am not getting that NOT NULL constraint for the enam column..Can any one please tell me how to solve this issue..
Thanks in advance