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 -> if exists and dropping tables

if exists and dropping tables

From: <TerryTraub_at_world.std.com>
Date: 1997/10/07
Message-ID: <EHnwqH.F6D@world.std.com>#1/1

Hi,
I'm doing an Oracle project after many years of Sybase and while I'm favorably impressed with many aspects of Oracle, I greatly miss the Sybase syntax for checking if a table exists:

  if exists (select * from sysobjects where name = 'my_table')   begin
    drop table my_table
  end
  go

  create table my_table (...)
  ...

This made for nice clean scripts. How do you do the equivalent in Oracle, to avoid getting lots of spurious error messages when installing tables the first time? Looks like this calls for some convoluted PL/SQL to check the USER_TABLES view or some such.

While I'm at it... Why can't you obtain result sets using stored procedures in Oracle? It makes for cleaner code to keep all the SQL in the server, and yet this limitation forces us to use Pro*C or OO4O, which binds the front end code too tightly to the database schema. Thanks for any enlightening postings!

-Terry Received on Tue Oct 07 1997 - 00:00:00 CDT

Original text of this message

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