Query :
SELECT DISTINCT st_str_hry.id_str_rt,
decode(co_strgp.nm_strgp,'HOLLAND & BARRETT','H&B','GNC UK','GNC')brandName
FROM co_strgp,
st_str_hry
WHERE co_strgp.id_strgp=st_str_hry.id_strgp
AND co_strgp.nm_strgp in(nvl(:brandName,
(SELECT co_strgp.nm_strgp
FROM co_strgp
WHERE id_strgp_lv='2'
AND id_strgp in
(SELECT DISTINCT id_strgp
FROM st_str_hry
WHERE id_str_rt in
(SELECT DISTINCT id_str_rt
FROM NBTY_TR_LTM_AER_RTN)))));
here the nvl part is throwing ora-01427 error
which says single query returning multiple rows
.
query
SELECT co_strgp.nm_strgp
FROM co_strgp
WHERE id_strgp_lv='2'
AND id_strgp in (SELECT DISTINCT id_strgp
FROM st_str_hry
WHERE id_str_rt in (SELECT DISTINCT id_str_rt
FROM NBTY_TR_LTM_AER_RTN))
is returning several rows, but it must return only one row
Rewrite the part of the code containing the subquery into this:
AND co_strgp.nm_strgp in(
( SELECT nvl( :brandName,co_strgp.nm_strgp )
FROM co_strgp
WHERE id_strgp_lv='2'
AND id_strgp in
(SELECT DISTINCT id_strgp
FROM st_str_hry
WHERE id_str_rt in
(SELECT DISTINCT id_str_rt
FROM NBTY_TR_LTM_AER_RTN)))));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.