Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: No data found when passing a variable holds string value to sql query in sap hana procedure

$
0
0

The following will not work variable1 = ' ABC' || ' and PRODUCT_ID = 101';

 

  Why because is the value of variable1 will be then 'ABC and PRODUCT_ID = 101', where it should only be 'ABC'.

 

Can you try the following,

 

variable1 = ' ABC' || TO_NVARCHAR(101);


select * from "SCHEMA1"."TABLE1" where product_name || TO_NVARCHAR(product_id  ) = :variable1 ;


 

But I recommend using the below, as I think this is the standard.

 

declare variable1 NVARCHAR(100);

declare variable2 INT;

 

variable1= 'ABC';

variable2= 101;

 

 

select * from "SCHEMA1"."TABLE1" where  product_name = :variable1  and product_id  = :variable2 ;


Regards,

Nithin


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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