Creating a Proper Import Script

Buy or Subscribe

You can access this course in just a minute, and support my efforts to rid the world of crappy online courses!

Buy Standalone  Subscribe

If we try to run our import script twice we're going to get an error because the schema already exists - as does our table. We could check to see if these things exist first, but it's much easier just to hose everything and rerun.

To do that, we need to drop everything first. We can also avoid errors by ensuring the drop only happens if the schema exists first:

drop schema if exists csvs cascade;

That cascade keyword will drop the target object and all dependent objects on it.