Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: using conditions in sql*plus

Re: using conditions in sql*plus

From: Jerry Gitomer <jgitomer_at_p3.net>
Date: 1998/02/27
Message-ID: <34F7942E.50F@p3.net>#1/1

Hi Jan,

If I understand your problem correctly I believe that the easiest solution is to wrap your SQL*Plus statements inside of PL/SQL BEGIN - END blocks. You can then do your test and select the block to execute or exit the script based on the results.

You can do this with a very simple PL/SQL program something along the lines of:

IF version test THEN

	BEGIN
		... update table 
	END;
ELSIF
	BEGIN
		... error processing
	END;

END IF; When you get it working correctly just save it as you would a regular SQL*Plus script. You can do this because it IS a SQL*Plus script and can be invoked like any other SQL*Plus script.

Regards

Jerry

Jan Timmermans wrote:
>
> Hi,
>
> to make changes in the definition of excisting tables, views, procedures and
> triggers we send sql scripts to our customers.
> These sql scripts can be executed from within sql*plus.
> The version of the tables is being stored in a special table VERSION.
> When an update script is executed we want to check whether the version
> of the tables is correct for that script. If not, the customer has to be
> notified
> and the script stops, if so the scripts continous normally.
> Problem : I can't find a way in sql*plus to excecute different code
> depending
> on a condition ( if then else ? ) or to stop an sql*script.
> Can anybody help me please !
>
> Thanx
>
> Jan
 

-- 
Jerry Gitomer		Since I know how to spell DBA I became one. 
jgitomer_at_p3.net
Received on Fri Feb 27 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US