10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Processing of SQL Statements<br />

Control Statements<br />

CREATE TYPE person_t AS OBJECT (<br />

name VARCHAR2(30),<br />

ssn VARCHAR2(12),<br />

address VARCHAR2(50))<br />

CREATE TABLE person_tab OF person_t<br />

OCCI applications treat transaction control, connection control, and system control<br />

statements like DML statements.<br />

Data Manipulation LanguageSQL Statements<br />

Queries<br />

Data manipulation language (DML) statements can change data in database tables.<br />

For example, DML statements are used to perform the following actions:<br />

■ Insert new rows into a table<br />

■ Update column values in existing rows<br />

■ Delete rows from a table<br />

■ Lock a table in the database<br />

■ Explain the execution plan for a SQL statement<br />

DML statements can require an application to supply data to the database by using<br />

input (bind) variables. Consider the following statement:<br />

INSERT INTO dept_tab VALUES(:1,:2,:3)<br />

Either this statement can be executed several times with different bind values, or an<br />

array insert can be performed to insert several rows in one round-trip to the server.<br />

DML statements also enable you to work with objects in the <strong>Oracle</strong> database, as in<br />

the following example, which inserts an instance of type person_t into the object<br />

table person_tab:<br />

INSERT INTO person_tab<br />

VALUES (person_t(’Steve May’,’123-45-6789’,’146 Winfield Street’))<br />

Queries are statements that retrieve data from tables in a database. A query can<br />

return zero, one, or many rows of data. All queries begin with the SQL keyword<br />

SELECT, as in the following example:<br />

1-6 <strong>Oracle</strong> <strong>C++</strong> <strong>Call</strong> <strong>Interface</strong> Programmer’s <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!