You can enter a SQL statement in four ways:
Pasting the statement
Typing the statement in the view
Opening a text file containing the SQL
Dragging a procedure or function from the Objects view
You can paste SELECT, INSERT, UPDATE, and DELETE statements to the view. Depending on which kind of statement you want to paste, PocketBuilder displays dialog boxes that guide you through painting the full statement.
To paste a SQL statement to the workspace:
Display the ISQL view in the Database painter.
Click the Paste SQL button in PainterBar2, or select Paste Special>SQL from the Edit or pop-up menu.
The SQL Statement Type dialog box displays, listing the types of SQL statements you can use.
Double-click the appropriate icon to select the statement type.
The Select Table dialog box displays.
Select the table(s) you will reference in the SQL statement.
You go to the Select, Insert, Update, or Delete painter, depending on the type of SQL statement you are pasting.
Do one of the following:
For a SELECT statement, define the statement exactly as in the Select painter when building a view.
You choose the columns to select. You can define computed columns, specify sorting and joining criteria, and WHERE, GROUP BY, and HAVING criteria. For more information, see “Working with database views”. For more information about the Select painter, see “Selecting a data source”.
For an INSERT statement, type the values to insert into each column. You can insert as many rows as you want.
For an UPDATE statement, specify the new values for the columns in the Update Column Values dialog box. Then specify the WHERE criteria to indicate which rows to update.
For a DELETE statement, specify the WHERE criteria to indicate which rows to delete.
When you have completed painting the SQL statement, click the Return button in the PainterBar in the Select, Insert, Update, or Delete painter.
You return to the Database painter with the SQL statement pasted into the ISQL view.
Rather than paste, you can simply type one or more SQL statements directly in the ISQL view.
You can enter most statements supported by your DBMS. This includes statements you can paint as well as statements you cannot paint, such as a database stored procedure or a CREATE TRIGGER statement. You cannot enter certain statements that could destabilize the PocketBuilder development environment. These include the SET statement and the USE database statement.
You can import SQL from a text file to the Database painter.
To read SQL from a file:
Put the insertion point where you want to insert the SQL.
Select Paste Special>From File from the Edit or pop-up menu.
Select the file containing the SQL and click OK.
From the tree view in the Objects view, you can select an existing procedure or function that contains a SQL statement you want to enter and drag it to the Interactive SQL view.