Basic Walkthrough DB2 Part-5
Basic Walkthrough DB2 Part-5 In this part we will study some more useful database objects. For example VIEWS, TRIGGERS, PROCEDURES and few other. As we had an introduction to trigger creation in part 2, we will discuss how we run scripts first. DB2 supports different kind of scripts. You can run system shell scripts (.bat, .cmd, .js, .vbs,.sh and many more). Let us try to understand how we can run scripts. Simple SQL script looks like C:\Program Files\IBM\SQLLIB\BIN> db2 –t -f script.sql connect to sample; select id,name,dept,job from staff; select count(*) from staff; connect reset; This was a simple SQL script. This is to be run in db2 command window. The syntax has been indicated in blue. Being an example script, I just listed few commands. In actual scripts these lines are usually over hundreds. Scripts can also be invoked in verbose mode (as echo on in DOS). C:\Program Files\IBM\S...