Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Not null constraint problem in creating a view

576659May 11 2007 — edited May 11 2007
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2007
Added on May 11 2007
13 comments
2,372 views