× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Do you have an example of this "IF EXISTS"

Thanks...Steve

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On 
Behalf Of Luqman
Sent: Thursday, November 11, 2004 3:13 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Drop procedure if it exists ?

Hi Hauser,

I have an sql script file which recreates 10 procedures and whenever I make
changes in any of the procedure, I just run that file, and if the procedure
does not exist and I use drop procedure, then the script stops and system
raises error that procedure cannot be drop because it does not exist.

Thats why I want to drop the procedure if it exists,before creating it 
again.

In oracle, create or replace procedure is very handy, while in sql server, 
IF EXISTS can be used to check
for procedure existance.


Best Regards,

Luqman




"HauserSSS" <Hauser@xxxxxxxxxxxxxxx> wrote in
message news:HFEAIBMAHGFKNPHBOMFIAEJNCCAA.Hauser@xxxxxxxxxxxxxxxxxx
Hi Larry and Luqman,

there is no UPDATE PROCEDURE or CHANGE PROCEDURE in SQL.
You have to drop the procedure before it can be recreated.
And because of the ability of overloading procedures, it is possible to have
a procedure with the same nambe but different number of parameters in the
same schema (or library).

If a procedure is overloaded, you must either specify the parameter
definitions or the specific name when dropping the procedure.

An IF-Statement can only be used in Triggers, Stored Procedures or User
Defined Functions.

But why no simply typing the drop statement and executing it.
If the procedure does not exist, the drop statement will not be successful!

In a Second Statement you can create the function.

Both statements can be seperated by semi colons (;)
and executed one after the other.

Birgitta


-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag
von Larry Ducie
Gesendet: Mittwoch, 10. November 2004 14:03
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: Drop procedure if it exists ?


Hi Luqman,

<snip>
How can I check using Navigator Run Sql Script, if the procedure already
exists, drop it before recreating it.
</snip>

You should be able to use:

CREATE or UPDATE procedure MYPROCEDURE... ?

Cheers

Larry Ducie


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.