Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Call sql script from another script in CLP

I’m using DB2 on Unix and I want to call a master script that run some other scripts within it. Note that I ‘m using CLP.

The master script would like as follow in Oracle :

@@script1
@@script2
etc

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is it possible to achieve this in DB2 using CLP ?

Note that I don’t want to a bash script to solve the problem.

>Solution :

The classic CLP on Db2-LUW, accessed via the db2 command, does not support that functionality.

If you do not want to use operating system scripting (such as bash etc) then your options are limited to the ! operator in the classic CLP but it will only invoke a separate process (i.e command-line interface, no shared variables, no control etc).

However, the alternative clpplus tool ( a java app, that is present both in the Db2-server product, and some Db2-client products ) does support Oracle-style scripting including the @ and @@ commands .

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading