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

How to return custom output message in store procedure after performing operation .

$
0
0

Hello Devps.

 

i m writing custom Exits for OData Write Requests in Hana

 

here is the simple example from Hana guide.

 

 

create procedure "ODATA_TEST"."sample.odata::createmethod"(IN new 
"sample.odata::table", OUT error "sample.odata::error") 
language sqlscript 
sql security invoker as 
 id INT;
begin
 select ID into id from :new;
 if :id < 1000 then
 error = select 400 as http_status_code, 
 'invalid ID' error_message, 
 'value must be >= 1000' detail from dummy;
 else
 insert into "sample.odata::table" values (:id);
 end if;
end;

 

the above procedure code is working fine if id values is less than 1000.

i want to write success message in the same error table after performing insert operation.

 

 

so for this i tried the below customized code in Hana

 

 

 

create procedure "ODATA_TEST"."sample.odata::createmethod"(IN new 
"sample.odata::table", OUT error "sample.odata::error") 
language sqlscript 
sql security invoker as 
 id INT;
begin
 select ID into id from :new;
 if :id < 1000 then
 error = select 400 as http_status_code, 
 'invalid ID' error_message, 
 'value must be >= 1000' detail from dummy;
 else
 insert into "sample.odata::table" values (:id);
//My Logic
error = select 400 as http_status_code, 
 'ID' error_message, 
 'Successfully inserted' detail from dummy;
 end if;
end;

 

but after updating my code. i am getting successful message. but its not inserting data in my table. and if i remove success message then i m able to persist data in table.

 

Can anyone help me with this. ???

 

Thanks..


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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