Skip to content

sql

April 3, 2008
select * from app where flag!=’Y’

What happens to those rows that are having flag = null?

If I have a table named temp:
name age
shivani 12
kirti 99
null 15

so the query : select * from temp where name!=’shivani’ will only return 1 row:
kirti 99

the reason is : null values are not checked against when doing string comparison.
even if we have a ” blank no space character inserted it is considered as a null.
So, to avoid that we must use nvl (name,’ ‘)!=’shivani’ and this will returns 2 records as expected….

Another point to take care is of outer joins. I remember you had some learnings from swift and others – could you take them up and note them here.

there are more things i remember – how to take care of null handling in oracle. there was this great article many yrs back. wd need to search for it again now.

🙂

Oracle q.

tada

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: