Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to eliminate null values in a column i.e
table vlaues
1 2 3
NULL 3 4
1 5 NULL
i want output like this
1 2 3
3 4
1 5
i dnt want to use nvl is null and i dnt want replace the
NULL value with any value i.e nvl(col,o);

Answers were Sorted based on User's Feedback



how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / chandra shekhar

Dear Lavanya,
You cannot equate the NULL with the operators like = and !=

NULLs can be equated with "IS NULL" or "IS NOT NULL"
(Double quotes " not included)

In u r query if u say IS NOT NULL, then also as per question asked in the very beginning it will not suffice.

As there are multiple columns with multiple NULLs in all the given columns .

Regards
J

Is This Answer Correct ?    3 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / dipti

The only option I feel is

SELECT * FROM TABLE
WHERE COL_NAME IS NOT NULL

will return the non null values which I think is asked for
this question.

Is This Answer Correct ?    2 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / hiya

SELECT REPLACE(A,'NULL',' '),
REPLACE(B,'NULL',' '),
REPLACE(C,'NULL',' ')FROM TEST1

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / srinu

Hi Ramkrish,

select *from k;

SNO
-----
1
2
3


3
4



9 rows selected

select sno from k where sno is not null;

SNO
-----
1
2
3
3
4

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / pankaj

suppose u have table named as emp

emp_id dept_id last_name salary

1 10 N1 10000

2 20 N2 10000

3 N3 12000

4 N4 12000

5 30 N5 15000


NOW IF U WANT TO RETRIEVE THE ROWS WITH ELIMINATING NULL
VALUES.

EX-

SELECT EMP_ID,DEPT_ID,LAST_NAME,SALARY
FROM EMP
WHERE DEPT_ID IS NOT NULL;

SO IN THE OUTPUT NULL VALUES WILL NOT BE RETRIVED MEANS
RECORD FOR EMP_ID 3 AND 4 WILL NOT BE RETRIVED.

REGARDS R

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / venkat reddy

1 select e.*,
2 case
3 when
4 comm is null then '0'
5 when
6 comm is not null then
7 to_char(comm) end as comm
8* from emp e
SQL> /

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO COMM
---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ------
7839 KING PRESIDENT 17-NOV-81 5000 10 0
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 0
7782 CLARK MANAGER 7839 09-JUN-81 2450 10 0
7566 JONES MANAGER 7839 02-APR-81 2975 20 0
7788 SCOTT ANALYST 7566 19-APR-87 3000 20 0
7902 FORD ANALYST 7566 03-DEC-81 3000 20 0
7369 SMITH CLERK 7902 17-DEC-80 800 20 0
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 300
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 500
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 1400
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 0
7876 ADAMS CLERK 7788 23-MAY-87 1100 20 0
7900 JAMES CLERK 7698 03-DEC-81 950 30 0
7934 MILLER CLERK 7782 23-JAN-82 1300 10 0

14 rows selected.

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / vijay_1994

please use group function is ignore the null values

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / shekharjchandra

Generally when u give query like
Select * from tablename; you will not get NULL displayed in Oracle SQL* Plus. I am not sure what tool you are using.

In SQL server you will get the output displayed NULL for null values.

If you still getting NULL as display value for null values then probably u have to do small change.

at SQL prompt use SQL* Plus command

SQL> SET NULL ""


now u give u r query, u will not get NULL displayed for null values

Regards
J

Is This Answer Correct ?    0 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / jayendra

Hi
You Can Replace the null without using nvl
function.
using replace key world
like this
Select Replace(values,'null')
from demo where values!=NULL;
it will display the result like this
1 2 3
3 4
1 5

Thanks
J.N.Tripathi
9868703898

Is This Answer Correct ?    0 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / j.n.tripathi

Hi
Sorry To ALL.....
For Above Answer
Writing Mistake there.....

You Can Replace the null without using nvl
function.
using replace key world
like this
Select Replace(values,'null')
from demo
it will display the result like this
1 2 3
3 4
1 5

Thanks
J.N.Tripathi
9868703898

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

Why are cursors used?

0 Answers  


If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

0 Answers  


What is use of trigger?

0 Answers  


How does a self join work?

0 Answers  


How to trace the errors in pl/sql block code?

5 Answers   TCS,


Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me

0 Answers  


What is rtm in testing?

0 Answers  


What is difference between inner join and cross join?

0 Answers  


1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...

0 Answers   Satyam,


what is the cursor and use of cursor in pl/sql ?

4 Answers  


How do I start pl sql?

0 Answers  


What are the different schemas objects that can be created using pl/sql?

0 Answers  


Categories