Re: Is this the sanctioned way to ascertain a table's existence?
Date: Fri, 16 Oct 2009 16:56:16 -0700 (PDT)
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?
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.
-- _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