I would like to ask if anyone has any idea/ know how to use SAP HANA SQLScript in DBeaver. Since SAP HANA supports some very useful features such as table variables etc, I would like to run following code (just a quick example):
do BEGIN
DECLARE lv_id INT;
lv_id = 100;
lt_test = SELECT id
FROM some_table
WHERE ref_id < :lv_id;
SELECT * FROM some_other_table
WHERE from_id IN (SELECT id FROM :lt_test); END;
but unfortunately it will give some error messages
sql syntax error: incorrect syntax near "NULL": line 13 col 35 (at pos 174)
Does anyone know if there is anything that can be done so this code will work in DBeaver without the need of going into SAP Web IDE or HANA Studio all the time?
Maybe someone also knows any other good IDE with features like code completion, etc., for SQL that works well with HANA (other than Web IDE and HANA Studio)...
The "trick" here is to select the correct handling of bind parameters in DBeaver.
When a SQL command with strings that look like bind parameters should be executed, DBeaver presents a dialogue window:
In this window, one can specify how the bind variables should be handled.
As the SQLScript variables are not bind variables (i.e. the client does not bind values to them) the correct selection in this window is to IGNORE the bind variables.