Skip to Content
avatar image
Former Member

Issue in generating multiple values

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 07, 2014 at 10:47 AM

    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

    Add comment
    10|10000 characters needed characters exceeded