Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

SY-SUBRC equivalent in HANA

$
0
0

Hi,

 

Do we have anything like sy-subrc in SQL.

 

I am trying to do as below.

 

a.) select * from regio_temp where based on my input parameter.

 

b.) If value found in step 1, fetch data from tab1.

 

c.) If no data in step 1, fetch data from tab2.

 

 

Please let me know how to handle this in procedure, as  its not possible in modelling.

 

 

 

 

CREATE PROCEDURE pr_select10(

IN  v_in_id    VARCHAR  (30),

OUT out_tt1 "HANA"."OUT_TT_SALES",

out out_tt2 "HANA"."OUT_TT_REGIO"

)

LANGUAGE SQLSCRIPT AS myrowid integer;

BEGIN

 

 

DECLARE found INT default 1  ;

 

 

 

 

SELECT * from "BEST"."REGIO_TEMP"

where "REGIO_TEMP_ID" = :v_in_id ;

     

IF :found = 0  THEN

 

 

out_tt2 =  SELECT * from "BEST"."REGIO_TEMP"

           where "REGIO_TEMP_ID" = :v_in_id;

           else

out_tt1 =  SELECT * from "BEST"."SALES_TEMP"

           where "REGIO_TEMP_ID" = :v_in_id; 

           end if;  

           SELECT * from "BEST"."REGIO_TEMP"

where "REGIO_TEMP_ID" = :v_in_id ;

END;


BR

Sumeet


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>