Re: Multiple Drop and Create View Statements
Posted in 2000
Topics: Server Administration
From: "Gail" <wormang@sutterhealth.org>
>
>I'm new to writing Informix SQL and would appreciate any assistance you can
>offer. My problem is,
>I am writing a script, which will DROP and CREATE multiple views (see
>example below). The DROP view does not always exist but I want to include
>the DROP so that if it does exist I can keep everything clean. The problem
>is if the DROP view doesn't exist the script stops with a file not found
>which I realize. My understanding is that there is another command I can
>use
>to keep the script processing even if a DROP view doesn't exist. I hope I'm
>explaining this well enough for someone to assist me.
Try running the script from the command line:
dbaccess yourdb yourscript.sql
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Obnoxio The Clown wrote:
> From: "Gail" <wormang@sutterhealth.org>
> >
> >I'm new to writing Informix SQL and would appreciate any assistance you can
> >offer. My problem is,
> >I am writing a script, which will DROP and CREATE multiple views (see
> >example below). The DROP view does not always exist but I want to include
> >the DROP so that if it does exist I can keep everything clean. The problem
> >is if the DROP view doesn?t exist the script stops with a file not found
> >which I realize. My understanding is that there is another command I can
> >use
> >to keep the script processing even if a DROP view doesn?t exist. I hope I?m
> >explaining this well enough for someone to assist me.
>
> Try running the script from the command line:
>
> dbaccess yourdb yourscript.sql
As well as these two suggestions, consider using SQLCMD from the IIUG archives.
It explicitly has continue options to handle this sort of thing:
continue push;
continue on;
DROP VIEW whatever;continue pop;
Obviously, this is the paranoid way of writing it; you could also write:
continue on;
DROP VIEW whatever;continue off;
But that could cause the program to stop when it didn't need to.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include
Guardian of DBD::Informix v0.95 -- http://www.perl.com/CPAN
"Windows is NOT a virus: a virus is small and efficient."