how to define a parameter in string syntax?

0

Hello,

I wrote parameter (its name $P{Query}) as follows; and it varies depend on value of $P{year}

$P{year} == 2012
? " select name from table2012  where rownum<9 and ref_no=$P{ref_no}"
: $P{year} == 2013
? " select name from table2013 rownum<9 and ref_no=$P{ref_no}"
: $P{year} == 2014
? " select name from table2014 rownum<9 and ref_no=$P{ref_no}"
: " select name from table2014"

 

and i add this parameter to query designer. but it did not work, because $P{ref_no} does not detect as a variable.

if i wrote number instead of $P{ref_no}  , " select name from table2014 rownum<9 and referans_no=2525, this is work.

how can define $P{ref_no}  as a parameter in this syntax?

loko852's picture
Joined: Mar 4 2014 - 10:06pm
Last seen: 5 years 2 months ago

1 Answer:

0

ok i solved it.

i changed  default value expression of parameter $P(query) as follow;

$P{year} == 2012
? " select name from table2012  where rownum<9 and "
: $P{year} == 2013
? " select name from table2013 rownum<9 and "
: $P{year} == 2014
? " select name from table2014 rownum<9 and "
: " select name from table2014"

 

and i wrote sql in query designer like that

$P!{query} and ref_no=$P{ref_no} 

and its work.

loko852's picture
Joined: Mar 4 2014 - 10:06pm
Last seen: 5 years 2 months ago
Feedback