Entering SQL Statements in the SQL Statement Area
You enter SQL statements by typing them in the SQL statement area in the Interactive SQL dialog.
- You do not need to end statements with a terminator, such as a semicolon. However, the terminator is not prohibited and does not cause a problem. You can, for example, copy and paste statements from scripts (where they must have terminators) and run them without removing the terminators.
- InterBase SQL statements are not case sensitive. You can enter all SQL statements in lowercase if you prefer.
- Anything inside quotation marks is case sensitive and must be entered as shown.
- InterBase ignores line breaks within statements. They are for your convenience only.
- You can use spaces to indent lines to make them easier to read. InterBase ignores these spaces. You cannot indent using tabs.
- You must execute each statement before entering the next one.
ExecutingStatements
To execute a statement, do one of the following:
- OR
- Select Query > Execute.
You must execute each statement before entering the next one.
- Note: Although this method of entering SQL statements by hand one at a time is an option in InterBase, users often use SQL scripts (data definition files) as a more convenient way of entering data. See “Running an SQL Script” on page 9 for more information.
Committing your Work
Until you commit your work, your transaction is said to be active. Work associated with an active transaction is not yet visible to other users. You often want to enter an entire group of related items before committing, so that misleading intermediate states are never visible. When you commit, your transaction changes to a committed state and the work you did in that transaction becomes visible to other users. When you are creating metadata, however, you usually want to commit each data structure as you complete the DDL statement. (See page 3 for a discussion of DDL and DML statements.)
InterBase provides an Autocommit feature that automatically commits any DDL statement when you execute it. The Autocommit feature does not apply to DML statements such as INSERT, UPDATE, DELETE, and SELECT. The Autocommit feature is enabled by default in InterBase.
Checking Session Sessings
To check the status of the Autocommit feature and other session settings, follow these steps:
- Click
to open the Interactive SQL dialog.
- Choose Edit > Options to display the SQL Options dialog.
- Check to see that the Auto Commit DDL is set to True. If not, enable the feature and click OK.