Running SQL Statements

In the Neoview Script interface, you can run SQL statements interactively. For a list of SQL statements that you can run interactively, see Appendix B (page 133).

This subsection shows examples of:

“Executing an SQL Statement” (page 59)

“Repeating an SQL Statement” (page 59)

“Preparing and Executing SQL Statements” (page 60)

To run SQL statements from script files in the Neoview Script interface, see Chapter 5 (page 67).

Executing an SQL Statement

For example, you can query the EMPLOYEE table and return an employee’s salary by executing this SELECT statement in the Neoview Script interface:

SQL>select salary +>from persnl.employee +>where jobcode=100;

SALARY

----------

175500.00

137000.10

139400.00

138000.40

75000.00

90000.00

118000.00

80000.00

70000.00

90000.00

56000.00

--- 11 row(s) selected.

SQL>

If the SQL statement executes successfully, Neoview Script returns a message indicating that the SQL operation was successful, followed by the standard prompt. If a problem occurs during the execution of the SQL statement, Neoview Script returns an error message. For information about error messages, see the Neoview Messages Manual.

Repeating an SQL Statement

To run a previously executed SQL statement, use the /, RUN, or REPEAT command.

SQL>/

SALARY

----------

175500.00

137000.10

139400.00

138000.40

75000.00

90000.00

118000.00

80000.00

70000.00

90000.00

56000.00

--- 11 row(s) selected.

Running SQL Statements 59