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 :


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 .

Leave a Reply