Re: PL/SQL: How to check if a table exists or not?

From: Eric M. Smith <erics_at_eastman.com>
Date: 1997/09/03
Message-ID: <01bcb883$93b1a250$598688a8_at_pc79301595>#1/1


Since the possibility of the tablename being a variable exists, why not obtain a count from user_tables. This way, the extra hassle of using the dbms_sql package is eliminated.

SELECT count(*)

   INTO RecCount
   FROM user_tables
  WHERE table_name = {VARCHAR2(50) table_name variable};

No exceptions would be thrown using this mechanism, therefore it also reduces the number of begin...end blocks being handled. This reduction makes the code far more readable and maintainable.

Eric M. Smith
Gibson Consulting, Inc.

Alexander G. Andzelevitch <aga_at_parad.ru> wrote in article <01bcb6b3$13a01230$38a7d1c3_at_aga>...
> Michael A. Casillas <casillas_at_icepr.com> wrote in article
> <34047555.2D31BB02_at_icepr.com>...
<<Original Text Clipped>> Received on Wed Sep 03 1997 - 00:00:00 CEST

Original text of this message