SQL Editor Dialog

Use this dialog to associate SQL statements with Java methods within a database CTRL file.

When you use this dialog, the changes you make are saved as new or modified methods with @jws:sql tags in the Database control's CTRL file.

# SQL

Type a SQL statement to be executed when the Java method (in the window below) is called. Use curly braces to substitute Java method parameters into your SQL statement. See the example and related topics below for syntax details.

# Java

Type a Java method declaration, including the its initial modifier (whether the method is public, private, etc.) and its return type. When you call this method from your web service, the SQL statement (in the window above) will be executed.

The possible return types for the Java method depend on what is returned from the database operation.

Most "administrative" operations such as INSERT and UPDATE return an integer indicating the number of rows affected.

SELECT queries may return a single value, a single row (or partial row) or multiple rows (or partial rows). To learn what Jave types are valid when for these database operation results, see the following topics:

- Returning a Single Value from a Database Control Method

- Returning a Single Row from a Database Control Method

- Returning Multiple Rows from a Database Control Method

# Example #1

## SQL

SELECT * FROM CUSTOMER

## JAVA

public java.sql.ResultSet findAllCustomersResultSet()

# Example #2

## SQL

SELECT CITY FROM CUSTOMER WHERE CUSTID = {key}

## JAVA

public String findCustomerCityByID(int key)

Related Topics

Database Control: Using a Database from Your Web Service

Creating a New Database Control

Parameter Substitution in @jws:sql Statements

Mapping Database Field Types to Java Types in the Database Control

@jws:sql Tag