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: 288
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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