Thursday, November 23, 2006

Create Tables and Add Constraints -- Oracle

Here's an easy way to create, configure and populate Oracle tables. It can be done from the command line but that can be quite cumbersome, especially if you need to make changes.

Open up a new file in Notepad
Populate it with your create, constraint, drop, insert and etc statements.
Save the file as filename.sql (don't forget the .sql extention)

e.g.
#sqlplus
**you will be prompt for login/password information**
SQL>@/home/esofthub/filename.sql;
--The "@" symbol executes the contents in the filename.sql file
--If you have errors/modifications, simply open the filename.sql in Notepad and make the necessary changes
--Then rerun the file using the "@" symbol

No comments: