Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to access null values from the table by a query?
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    Post subject: Re: How to access null values from the table by a query?
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us