Because you specified LEFT Outer join - by definition - you are asking DB2 to return all rows for the left table and if a corresponding row exists on the right return the desired values else return nulls ....
William B. Gannon
- IBM Certified Solutions Expert
- IBM Certified Database Administrator
DB2 Universal Database V8.1 for zOS
________________________________
From: Mohammed Mohsin [mailto:db2udbdba-ezmlmshield-x17174471.[Email address protected]
Sent: Mon 10/29/2007 7:38 AM
To: LazyDBA Discussion
Subject: Strange observation with view
Hi,
I have created a simple view
create view user.v_test
( full_name,
employee_number,
address_of_employee,
salary_of_employee)
as
select
a.name,
a.emp_no,
a.address,
b.salary
From user.info a
Left outer join user.sal b
Where a.emp_no = b.emp_no;
My observation is all the columns in both the tables are having not
null constraint, but when I describe table user.v_test (that is the
view) I can see for the column salary_of_employee its showing null yes.
Why is this happening in spite of the fact that the derived column is
not null in the table user.sal
Rgds,
Mohsin
Phone : +91-80-22489390x8452
Mobile : 9886990254
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com <http://jobs.lazydba.com/>
To Subscribe : http://www.LazyDBA.com <http://www.lazydba.com/>
To unsubscribe: http://www.lazydba.com/unsubscribe.html
-----------------------------------------
Under Florida law, e-mail addresses are public records. If you do
not want your e-mail address released in response to a public
records request, do not send electronic mail to this entity.
Instead, contact this office by phone or in writing.
DB2 & UDB email list listserv db2-l LazyDBA home page