My browser reported timeout error, so I posted this question one more again... please delete this duplicity thread.
Hi,
does anybody know how to test in script files if values already exists in a table(s), please?
I have following data.sql script:
---
CONNECT TO MyDB;
INSERT INTO APPCONFIG (KEY, VALUE) VALUES ('someKey', 'someValue');
CONNECT RESET;
---(APPCONFIG is my custom table)
I run this script using DB2 command line tool:
---
DB2 -tf data.sql
---
My problem is, that this script may be run more than once. So i need to add some IF statement to test if the key alerady exists. I've tried a lot of IF SELECT COUNT(*) FROM ... statements, but I still receive syntax errors etc.
Can anybody help me, please?