Is this the sanctioned way to ascertain a table's existence?
14/05/2018 11:47
All my database accesses are done through Pro*C/C++.

Sometimes my code needs to verify whether a table exists. Years ago, Iwas about to post that particular questions here. I then realizedthat the following statements achieve the desired results: EXEC SQL SELECT COUNT(1) INTO :howMany FROM user_tables WHEREtable_name = :table_name; if (howMany == 1) doThis();else doThat(); Is that the proper way? -Ramon

Source is Usenet: comp.databases.oracle.misc
Sign in to add a comment

Answer score: 5
14/05/2018 11:47 - Ramon F Herrera schreef: 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

Source is Usenet: comp.databases.oracle.misc
Sign in to add a comment

Answer score: 5
14/05/2018 11:47 - I I obviously agree with joel, and would like to put the Great Bard'sworries to rest.

My applications create a whole bunch of SQL statements on the fly,using C++. Assembling those SQL statements is an expensive task,computationally speaking. Therefore, even before my code embarks intothe task of preparing a set of complex query(es), it should make surethat at least the basic table (called 'google' in my previous example)exists.

Let me use an actual real example. I hate getting inside the sqlplusshell with the fury of 1K suns. I am a clumsy typist and am used tomodern shells. Therefore I wrote a handy utility called 'nrec', whichI run from the Unix prompt: % nrec table_this% 1242 % nrec table_that% 5639 Internally, the command 'nrec' actually is a simple: SELECT COUNT(1) from :someTable; The user can type (or mistype) any table name, which should be checkedbefore attempting to perform the actual COUNT. Let's say that I preferto handle errors on my own instead of feeding crap to Oracle.

-Ramon

Source is Usenet: comp.databases.oracle.misc
Sign in to add a comment

Answer score: 5
14/05/2018 11:47 - I think it is reasonable for many applications, they can ascertainwhere in a process things are or whether they are being run for thefirst time. Now, I'm a great believer in the DBA being in control ofDDL, and I think you are right to worry, I'm just saying it isn'tnecessarily in the nightmare realm.

As far as the proper way, TIMTOWTDI.

jg

Source is Usenet: comp.databases.oracle.misc
Sign in to add a comment

eDiscover
Helpforce eDiscover provides technical articles updated each dayHelpforce eDiscover RSS feed contains the latest technical articles in RSS
Click the logo to go back to the main page
Search eDiscover
  
Categories

Click an icon to go to that category

Helpforce eDiscover contains articles about Microsoft Windows Helpforce eDiscover contains articles about Apple products and MacOS Helpforce eDiscover contains articles about Linux and POSIX operating systems Helpforce eDiscover contains articles about Helpforce Helpforce has a large variety of technical information and articles for you to read Helpforce eDiscover contains articles about databases, MYSQL, SQL Server Oracle Helpforce eDiscover contains articles about Java, JVM and the JRE Helpforce eDiscover contains articles about the QNX operating system Helpforce eDiscover contains articles about Oracle Solaris and Open Solaris Helpforce eDiscover contains articles about RISC OS, Acorn and the BBC Micro Helpforce eDiscover contains articles about Amiga and AmigaOS

Type your comment into the box below