Quantcast
Channel: SCN: Message List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 8968

Re: How to read number of rows using table variable

$
0
0

Hi,

I assume your question is how to find number of records into a scalar variable so that you can program on that result.

 

Look at example below from SQLScript guide.

 

CREATE PROCEDURE upsert_proc (IN v_isbn VARCHAR(20))

LANGUAGE SQLSCRIPT AS

found INT := 1;

BEGIN

SELECT count(*) INTO found FROM books WHERE isbn = :v_isbn;

IF :found = 0

THEN

INSERT INTO books

VALUES (:v_isbn, 'In-Memory Data Management', 1, 1,

'2011', 42.75, 'EUR');

ELSE

UPDATE books SET price = 42.75 WHERE isbn =:v_isbn;

END IF;

END;


Viewing all articles
Browse latest Browse all 8968

Trending Articles