Documentation > System Stored Procedures > @AdHoc

@AdHoc

Execute an arbitrary SQL query on the H-Store cluster. Note that these queries cannot be parameterized. That is, you must hardcode all of the input parameters used in the query directly (i.e., it does not support ‘?’).

See also VoltDB Documentation.

Input Parameters

Name Type Description
SQL String The query to execute

Return Values

A single VoltTable that contains the result of the executed query.

Java Example

Client client = ClientFactory.createClient();
client = client.createConnection(hostname, port);
String query = "SELECT COUNT(*) FROM WAREHOUSE";
ClientResponse cresponse = client.callProcedure("@AdHoc", query);

Command-Line Example

Note that unlike other system procedures, you do not need to use the EXEC command to execute an arbitrary SQL statement in H-Store’s command-line tool. Any query entered in the tool will automatically invoke the @AdHoc procedure.

hstore> SELECT COUNT(*) FROM WAREHOUSE;