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

From: Ramon F Herrera <ramon_at_conexus.net>
Date: Fri, 16 Oct 2009 16:32:55 -0700 (PDT)
Message-ID: <77fe2001-5e40-4e38-8398-7d4e45586115_at_k33g2000yqa.googlegroups.com>


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 Received on Fri Oct 16 2009 - 18:32:55 CDT

Original text of this message