all parameter data display [message #299474] |
Tue, 12 February 2008 03:07 |
gozuhair
Messages: 206 Registered: January 2008
|
Senior Member |
|
|
Sir
I have a report that contains 10 parameters of a same column name "def_prt".I am using in operator in this report for example.
select count(a.wc_id),b.def_prt
from sv_warr a,def_mst b
where a.prt_cd=b.prt_cd
and b.gr_desc in (nvl(:prt_1,b.gr_desc), **Problem area**nvl(:prt_2,b.gr_desc),
nvl(:prt_3,b.gr_desc))
--
--
--
--
--
when i remove all 10 parameter then the output shows all defective parts that is ok but if i select more than one parameter then only 1st input parameter defective parts display instead of all input parameter.
How can i solve this problem
|
|
|
Re: all parameter data display [message #299511 is a reply to message #299474] |
Tue, 12 February 2008 05:06 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I must admit that I don't understand the problem.
Query, the way you've written it, is meaningless - it will always return all records, no matter what is the value of any of these parameters.
Quote: | when i remove all 10 parameter then the output shows all defective parts
| True, as NVL's will use 'b.gr_desc'.
Quote: | if i select more than one parameter
| You mean, you enter some value into 'prt_1'?
Quote: | then only 1st input parameter defective parts display instead of all input parameter
| I wouldn't say so; first parameter's value is used, but NVL's will again make all records to appear. See an example, based on Scott's schema:SQL> l
1 select count(*) from emp
2* where deptno in (nvl(&d1, deptno), nvl(&d2, deptno), nvl(&d3, deptno))
SQL> /
Enter value for d1: null
Enter value for d2: null
Enter value for d3: null
COUNT(*)
----------
14
SQL> /
Enter value for d1: 10
Enter value for d2: null
Enter value for d3: null
COUNT(*)
----------
14
SQL> /
Enter value for d1: 10
Enter value for d2: null
Enter value for d3: 20
COUNT(*)
----------
14
SQL> As you can see, no matter what is the value of any of these parameters, count(*) will always return all 14 employees.
What are you, actually, trying to do?
|
|
|