IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to access null values from the table by a query?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasa
Warnings : 1

New User


Joined: 10 Jan 2006
Posts: 9

PostPosted: Sat Mar 18, 2006 12:49 pm
Reply with quote

How to access null values from the table by a query?
please send me the query.
Back to top
View user's profile Send private message
ragshere

New User


Joined: 20 Dec 2004
Posts: 70

PostPosted: Mon Mar 20, 2006 2:11 pm
Reply with quote

vasa,
use this below query as a sample

select * from tablename
where col1 is null


Thanks
Rags
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Mar 20, 2006 3:30 pm
Reply with quote

Hi,

Consider the employee table with column PROJECT nullable. How can you get a list of employees who are not assigned to any project or rows that have null values in PROJECT

SELECT EMPNO
FROM EMP
WHERE PROJECT IS NULL;

The standard to be followed for writing a select st is to give the name of the column to be selected than a '*'.

Thanks,
KS
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Mar 20, 2006 3:33 pm
Reply with quote

Hi,

Hope am correct abt the standard.If not , kindly correct .

Thanks,
KS
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Mon Mar 20, 2006 3:50 pm
Reply with quote

hy,

just note:
if you use the INTO variables clause,
you should never forget to give with
the variable also an indicator variable.
because if the value is null and you give no
indicator, your sql statement will abend.

martin9
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top