Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2 7.x Scripting with "if" Statement

Status
Not open for further replies.

shew01

MIS
Jan 30, 2003
6
US
I had a sample DB2 7.x script working with the "if" statement, but I managed to overwrite the working copy. (Not one of my better moments...) Oh, well... Can someone help me?

The DB2 script is named temp5.sql and contains the following syntax:

connect to metrics@

begin atomic
declare testVar integer default 0;

set testVar = 1;

if testVar=0 then
select 'Zero' from sysibm.sysdummy1;
else
select 'Non-Zero' from sysibm.sysdummy1;
end if;
end@

connect reset@

And I think it got called with the following AIX 4.3.3 syntax, but I'm not sure:

db2 -tvf temp5.sql

Thanks in advance!

Jon
 
What exactly is your question? The compound sql statement above runs fine using DB2Batch, although I am using DB2 8.2. I'm assuming you set your end statement delimiter to @.

--#SET DELIMITER @
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top