I am completely new to HANA DB as we just start to migrate our smaller SAP Netweaver java Applications to HANA from Oracle I am currently working on finding out what to consider, playing around on sandbox level with try&error running the scripts, adapting them to HANA to create a concept for the other applications afterwards.
Maybe its because I dropped off my bed today, but I can not find an answer to my question with Google or Stackoverflow, however I might just use the wrong search phrases, so please feel free to give me a little hint.
We have an Oracle SQL File which contains all other sql file-names to be executed in order, so we do not need to run every single script and always have the correct order.
The File is structured like this and is run line by line when rolling out the Table to the next stage (sandbox, dev, QA, prod) to have a manual check in case of error.
@001_CreateXYZ.sql
COMMIT;
@002_InsertXYZ.sql
COMMIT;
@003_AlterXYZ.sql
COMMIT;
I can not find any equal phrase for HANA to run several SQL scripts that are placed in the same folder than the one above.
I already thought about writing a procedure for that, but I just cant believe that there is nothing available to execute a sql file in Hana Studio from a Script.
Sorry for the quite long text compared to the simple question. Thanks for still reading it.
Greetings,
Gian-Marco
HANA Studio doesn't provide the option of referenced SQL scripts and neither does hdbsql
.
Looking at your example it stands out that there are explicit COMMIT
s in there. Whatever your alternative solution looks like, you should keep in mind that in HANA Studio the default is AUTOCOMMIT=TRUE
, so if you rely on the ability to rollback commands, make sure to change that setting.
Also: I'm not quite sure what exactly you do with the scripts, but typical tasks like deploying DB structure changes across multiple machines, etc. are usually done via application lifecycle management (LCM
) in HANA, which removes the need for scripts. Details on this are of course to be found in the documenation.