You can delete a table or database by sending the delete message to an instance of AbtTable.
Oracle does not allow you to delete a database. Attempting to do so
will result in an error.
| You cannot use these examples to delete databases under Windows. |
The following examples show how to delete the PEOPLE table from the CORPDATA database and then delete the CORPDATA database. These examples do the following:
To use this code, follow these steps:
This expression returns an empty ordered collection, showing that you have deleted the table.
This expression returns an ordered collection, showing that you have deleted the table.
"Delete a table"
| connection |
connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'CORPDATA'.
deleteTableNamed: 'PEOPLE'.
"Display all tables"
| connection |
connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'CORPDATA'.
allUserTableNames.
"Delete a database"
| connection |
connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'CORPDATA'.
deleteDatabaseNamed: 'CORPDATA'.
"Display all databases"
| connection |
connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'CORPDATA'.
allDatabaseNames.