Re: Anyone writing stored procs
Posted in 1996
Brian Weedman wrote:
>
> How do you know if your proc exists in informix so you can drop it
> before trying to re-restore it. In SqlServer you can do this
>
> If (Exists (Select * from sysobjects where name = 'procname' and type = 'P'))
> Drop proc procname
> go
>
> I would like to do this for tables too.
>
> sqlserver syntax:
> If (Exists (Select * from sysobjects where name = 'tablename' and type = 'U'))
> Drop table tablename>
> Is there anything like it in informix? Or is there a way to get
> the informix sql editor to continue on even if theres an error.
You can tell if your procedure exists in informix using the following
query:
select count(*) into pcount from sysprocedures where procname='procname'if pcount > 0 then
drop procedure procname
end if
For triggers select trigname from systriggers,
For tables select tabname from systables.
We are running informix 7.1 in AIX and use dbaccess to create our sps.
If you run dbaccess from the command line and an error occurs dbaccess
will continue to process the sql file.
dbaccess dbname sqlfilename.sql