Data Manipulation Statements
Data manipulation statements let you access and modify the contents of your database. Pervasive PSQL allows you to construct data manipulation statements to do the following:
The following sections briefly describe the SQL statements associated with each of these tasks.
Retrieving Data
All statements you use to retrieve information from a database are based on the SELECT statement.
Table 10
When you create a SELECT statement, you can use various clauses to specify different options. (See the entry for the SELECT statement in ODBC Engine Reference for detailed information about each type of clause.) The types of clauses you use in a SELECT statement are as follows:
Table 11
In addition, you can use the UNION keyword to obtain a single result table from multiple SELECT queries.
Modifying Data
You can add, change, or delete data from tables and views by issuing statements such as the following:
Table 12
When you create a DELETE or UPDATE statement, you can use a WHERE clause to define search criteria that restrict the data upon which the statement acts.
Defining Transactions
To update the data in a database, you can issue SQL statements individually or you can define transactions (logical units of related statements). By defining transactions, you can ensure that either all the statements in a unit of work are executed successfully or none are executed. You can use transactions to group statements to ensure the logical integrity of your database.
Pervasive PSQL supports the ODBC API SQLTransact. See the Microsoft ODBC Programmer’s Reference for more information.
Creating and Deleting Views
You can create and delete views by constructing SQL using the following statements:
Table 13
Executing Stored Procedures
A stored procedure consists of statements that you can precompile and save in the dictionary. To execute stored procedures, construct statements using the following:
Table 14
CALL or EXEC[UTE]
Executing System Stored Procedures
A system stored procedure helps you accomplish those administrative and informative tasks that are not covered by the Data Definition Language. The system stored procedures have a psp_ prefix. To execute stored procedures, construct statements using the following:
Table 15
CALL or EXEC[UTE]
For more details, see System Stored Procedures.
Executing Triggers
A trigger consists of statements you can precompile and save in the dictionary. Triggers are executed automatically by the engine when the specified conditions occur.