View previous topic :: View next topic
|
Author |
Message |
marisalondon
New User
Joined: 21 Aug 2009 Posts: 10 Location: London
|
|
|
|
Hi
I am trying to run a SQL sentence using a batch job (JCL is successful). The SQL sentence is introduced in a file.
Purpose to be able to
SET CURRENT SQLID = ‘XXX’
CREATE SYNONYM BBB for XXX.BBB
The problem is that if the synonym exist, then it fails (RC=8). I tried to DROP, but again errors out if it doesn’t exist.
At this point, we tried to use IF EXISTS.
We are trying with:
IF NOT EXISTS (SELECT * FROM SYSIBM.SYSSYNONYM WHERE NAME = BBB) THEN CREATE SYNONYM ...
The errors SQLCODE -104 (Illegal exists)
Any suguestions?
Thanks, |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi Marisalondon,
IF statements are used in stored procedures, not in a query processor.
Sushanth |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi marisalondon,
Can you post your drop statement. Did you commit after drop?.
Thanks
Sai |
|
Back to top |
|
|
|