on 05-02-2014 1:25 PM
Hi all,
I have a requirement like I have to select IP for a particular Employee Number. If the IP is null then I want every IP from a different table.
I created the following statement for understanding.
select
case when (select
ip_main_id
from "SPEND"."FACT_DATA_EXCEPTIONS_TMX"
where employee_number = '583853') is not null
then (select
ip_main_id
from "SPEND"."FACT_DATA_EXCEPTIONS_TMX"
where employee_number = '583583')
else (select
iou
from "_SYS_BIC"."Spend/CV_CLAIMS_TREND_DASHBOARD_IOU" )
end
from dummy
But I am getting error as
"
Could not execute 'select case when (select ip_main_id from "SPEND"."FACT_DATA_EXCEPTIONS_TMX" where employee_number = ...' in 1.041 seconds .
SAP DBTech JDBC: [305]: single-row query returns more than one row:"
Because "_SYS_BIC"."Spend/CV_CLAIMS_TREND_DASHBOARD_IOU" contains more than one IOU.
Is there any way I can create the above query in HANA or create a procedure.
Regards,
Nakul Kothari
+919987039379
Hi Nakul,
This Query:
select ip_main_id from "SPEND"."FACT_DATA_EXCEPTIONS_TMX"
where employee_number = '583583'
Is giving more than one value and hence you are getting that error. So use count statement to check if there are records and then you can do what you required.
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.