Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Create a table only if the table doesn't exists

Re: Create a table only if the table doesn't exists

From: <bbulsara23_at_hotmail.com>
Date: 24 Jun 2006 08:09:07 -0700
Message-ID: <1151161747.713891.147360@b68g2000cwa.googlegroups.com>


DA Morgan wrote:
> Better but still a very bad idea. What is the business case for
> implementing a known bad practice of creating tables with procedural
> code?

I don't know what his business case is, but I can tell you one of mine!

In a test environment I recently came across a need to creating tables on the fly. I was developing a suite of unit tests based around Feuersteins' ut_plsql. The unit test setup and teardown procedures required that tables were created and torn down in package/procedural code, so the unit tests were performed against isolated controlled data known to and populated by the unit test package.

In the setup code, a test table was procedurally created and populated. In the teardown code, the test table was dropped and remaining schema objects restored to their initial state. The unit tests used the known data populated in the table and tested it against expected results.

This is a valid reason for wanting to create (and drop) tables on the fly, the business case being the assurance that the system behaves as designed and expected through thorough (automated unit) testing. Feuerstein even has examples (eg. testproc.html from the ut_plsql documentation) where he demonstrates creating tables on the fly, and why he does it.

The OP doesn't give much detail, but perhaps, just perhaps, his business case is as valid as this.

More information on ut_plsql can be found here: http://utplsql.sourceforge.net/

Regards
Barry Received on Sat Jun 24 2006 - 10:09:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US