Quantcast
Channel: SCN : All Content - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6745

SQL HANA QUERY IF NOT EXIST Sub query

$
0
0

I need this kind of  query to hana, i used the same query on SQL SERVER;

 

IF NOT EXISTS (SELECT * FROM "@MyUserTable" WHERE "Code" = 'xxx')

THEN (INSERT INTO "@MyUserTable"("Code","Name")

              VALUES((Select IFNULL(MAX(TO_INT("Code")), 0)+1 FROM "@MyUserTable")

                      ,'valueName'

                     )

      )

ELSE (UPDATE "@MyUserTable"

       SET "Name" = 'valueName'

       WHERE "Cade" = 'xxx')

 

On hana studio this query returned error.

 

 

Maybe you may help me to find a solution.


Viewing all articles
Browse latest Browse all 6745

Trending Articles



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