Re: Is this the sanctioned way to ascertain a table's existence?

From: joel garry <joel-garry_at_home.com>
Date: Fri, 16 Oct 2009 16:56:16 -0700 (PDT)
Message-ID: <d611339e-8c43-440b-8dd6-6df13d14db45_at_2g2000prl.googlegroups.com>



On Oct 16, 4:48 pm, Shakespeare <what..._at_xs4all.nl> wrote:
> Ramon F Herrera schreef:
>
>
>
> > All my database accesses are done through Pro*C/C++.
>
> > Sometimes my code needs to verify whether a table exists. Years ago, I
> > was about to post that particular  questions here. I then realized
> > that the following statements achieve the desired results:
>
> > EXEC SQL SELECT COUNT(1) INTO :howMany FROM user_tables WHERE
> > table_name = :table_name;
>
> > if (howMany == 1)
> >     doThis();
> > else
> >    doThat();
>
> > Is that "the" proper way?
>
> > -Ramon
>
> I always get a bit worried if an application has to check whether a
> table exists.... should they not be there just by design?
>
> Shakespeare

I think it is reasonable for many applications, they can ascertain where in a process things are or whether they are being run for the first time. Now, I'm a great believer in the DBA being in control of DDL, and I think you are right to worry, I'm just saying it isn't necessarily in the nightmare realm.

As far as the proper way, TIMTOWTDI.

jg

--
_at_home.com is bogus.
yay, boss is going fishing!  That means I can... have more work to
do... boo.
Received on Fri Oct 16 2009 - 18:56:16 CDT

Original text of this message