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

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

$
0
0

Hello,

 

In a procedure, there are following lines of code which has 3 select statements:

 

"

declare variable1 NVARCHAR(100);

declare variable2 INT;

 

variable1= '''ABC''';

variable2= 101;

 

--Statement1:

select :variable1 from dummy;

 

--Statement2:

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

 

--Statement3:

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

"

 

While executing the procedure, we get 3 results generated from above 3 SQL select statements.

 

Here, we get results for statement1 & 3.

 

But Statement2 doesn't give any result and appears as blank. ie., when we pass a variable which is declared as string and holding string value to a sql query, it doesn't gives any data.  But the same gives data when we pass integer variable(as shown in statement 3)

 

Can you please give me some knowledge as in why the statement 2 doesn't give any result and the reason behind it?  Also, can you please suggest the way to be implemented in statement 2 so that we'll get the result?

 

Thanks in advance.

 

Regards,

Antony Jerald.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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