Hi all,
Can any one give answer for this question.
Suppose im having employee table with fields, eno, ename,
dept, address1, address2, address3.
In address field employee can fill only address1 or address2
or address3... at a time he can fill three address fields.
now i want all employee names who filled only one address
field.. Plz its urjent can any one give querry.. Thanks in
advance.
Answers were Sorted based on User's Feedback
Answer / jigar
Select ename from employee
where
to_char(nvl2(address1,'1','0')||nvl2(address2,'1','0')||nvl2(address3,'1','0'))
in ('100','010','001')
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / nathan
WITH temp AS
(SELECT 1 ID, 'delhi' add1, 'mumbai' add2, 'guj' add3
FROM DUAL
UNION ALL
SELECT 2 ID, NULL add1, 'mumbai' add2, NULL add3
FROM DUAL
UNION ALL
SELECT 3 ID, 'delhi' add1, NULL add2, 'guj' add3
FROM DUAL)
SELECT *
FROM (SELECT ID, NVL (add1, 0) + NVL (add2, 0) + NVL
(add3, 0) address
FROM (SELECT ID, DECODE (add1, NULL, NULL, 1) add1,
DECODE (add2, NULL, NULL, 1) add2,
DECODE (add3, NULL, NULL, 1) add3
FROM temp))
WHERE address = 1;
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / babuli
select ename from emp where (address1 is not null or address2
is not null or address3 is not null) and
((address1 is null and address2 is null ) or (address1 is
null and address3 is null ) or (address2 is null and address3
is null ))
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / ajit
select *from addr1 where add1 is not null and add2 is null
and add3 is null or add1 is null and add2 is not null and
add3 is null or add1 is null and add2 is null
and add3 is not null
| Is This Answer Correct ? | 0 Yes | 3 No |
What is SAVE POINT ?
What is meant by an index?
1. Display all the rows and columns in the CLIENT table. Sort by client name in reverse alphabetical order.
1. Display the post code and the purchase order number for each purchase order. Sort the output set by postcode.
4. Display the order number and client number from the ORDER table. Output the result in the format. Client <clientno> ordered <orderno>
What is the database name in oracle?
You have one employee table having 3 entries emp_id, Mgr_id and salary. Mgr_id is also referencing emp_id. so now find out the emp_id which are having the second highest salary, under a particular manager.
how to code performance tuning of oracle PL/SQL? can any body send me the perfect answer?
What happens in oracle commit?
i must get table name, constraint type, constrain name with using concads "||" and it must be in string type, then with join processes i need code please help immidiately
What is Undo Management Advisor in Oracle?
i have procedure p1.and also i declare the same procedure in a package. whice one is efficient package procedure or procedure?