Konstantin Andreev wrote:
Begin atomic
if( exists(
select 1 from syscat.tables where tabschema = 'MYSCHEMA' and tabname =
'MYTABLE' )) then
drop table MYSCHEMA.MYTABLE;
end if;
End
Hmm.. but it does not work for me.
I've saved this into a file TEST.SQL:
Begin atomic
* * if (exists(select 1 from syscat.tables where tabschema = 'MYSCHEMA' and
tabname = 'MYTABLE')) then
* * * * drop table MYSCHEMA.MYTABLE;
* * end if;
End
#
ran it like:
db2 -td# -f TEST.SQL
and got:
B21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "* *" was found following "Begin atomic ".
Expected tokens may include: "<space>". LINE NUMBER=2. SQLSTATE=42601
I've tried this approach, but to no avail.
Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| Gregor Kovac |
Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-