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

Re: Ignore where clauses when the value is space

$
0
0

Hi there,

 

I just got the same requirement and got a question about it...

Since dynamic SQL should be avoided, I would like to solve this using a if statement.

 

What I got looks like this:

    IF lv_name IS NULL THEN
   result = SELECT * FROM CUSTOMER;
   ELSE
   result = SELECT * FROM CUSTOMER WHERE C_NAME = :lv_name;
   END IF;

 

The problem is I can't iterate over the result table since it is not a cursor.

Question: How to change result into a cursor?

 

According to this document on page 26 something like this should work:

 

CURSOR result FOR SELECT * FROM CUSTOMER WHERE C_NAME = :lv_name;

 

but that gives me a syntax error.

Any ideas?

Thanks!


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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