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: SQL possible equivalent

Re: SQL possible equivalent

From: Jeff Kish <jeff.kish_at_mro.com>
Date: Wed, 30 May 2007 10:39:44 -0400
Message-ID: <f03r53h8tr3snijv1lq9p2ud876997c5li@4ax.com>


<snip>
>
>Please try to forget any of the Mickeysucks kludges you learned when
>using sqlserver.
>The typical approach of Oracle is
>
>whenever sqlerror continue -- the default
>drop table foo;
>
>create table foo;
>
>exit
>
>If table foo doesn't exist, the statement will fail and Oracle will
>continue to create it.
>If the table does exist, it will be dropped.
>
>If you insist in creating a non-scalable application you would need to
>
>declare dummy varchar2(1);
>begin
> begin
> select 'x' into dummy
> from dual
> where exists
> (select 'x'
> from user_tables
> where table_name='foo'
> );
> exception when no_data_found then dummy := '';
> end;
> if dummy = 'x' then
> execute immediate 'drop table foo';
> end if;
> execute immediate 'create table foo';
> end;
>/
>
>Please take a piece of paper now and write 100 times
>'I need to stop trying to turn Oracle in sqlserver or I will end up in
>hell'

thanks. I'm not trying to turn oracle into sql server (one of the very last things I'd like to do).. I figured there must be a better approach since I was in oracle.
it is for an installation program that is reinstalling because of a previous failed install.

that last non scalable code is pl/sql, isn't it .. with the declare and what not?

>The typical approach of Oracle is
>
>whenever sqlerror continue

very good.. thanks
regards
Jeff Kish Received on Wed May 30 2007 - 09:39:44 CDT

Original text of this message

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