Entering SQL

You can enter a SQL statement in four ways:

Pasting SQL

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.

StepsTo paste a SQL statement to the workspace:

  1. Display the ISQL view in the Database painter.

  2. 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.

  3. Double-click the appropriate icon to select the statement type.

    The Select Table dialog box displays.

  4. 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.

  5. Do one of the following:

  6. 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.

Typing SQL

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.

Importing SQL from a text file

You can import SQL from a text file to the Database painter.

StepsTo read SQL from a file:

  1. Put the insertion point where you want to insert the SQL.

  2. Select Paste Special>From File from the Edit or pop-up menu.

  3. Select the file containing the SQL and click OK.

Dragging a procedure or function from the Objects view

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.