Pro*C Sample Programs

The following Pro*C sample programs are available in the quickstart/sample_code/proc directory.

  Program Description
  addempPROC.pc This Pro*C sample program prompts the user for information and inserts the corresponding data as a new employee into the EMP table.

This program is based on the Oracle Pro*C sample.pc program and minimal error checking is performed on the data to be inserted.

The EMP table needs to exist for this program to work.
  ansidyn1.pc Ansidyn1.pc is an Oracle Pro*C program that implements a dynamic SQL interpreter. Using the ANSI embedded SQL syntax, Ansidyn1.pc accepts dynamic SQL at the input command prompt (SQL>)

You are prompted for the username and password at runtime. The ‘servicename’ can be either an entry in the TNSnames.ora file or an easy connect string.

No existing tables need to exist for this program to work.

  batchfetchPROC.pc This Pro*C sample program connects to the database and then declares and opens a cursor, fetches in batches using arrays, and prints the results using the function print_rows().

The EMP table needs to exist for this program to work.
  cursorPROC.pc This Pro*C sample program connects to the database and then declares and opens a cursor. The cursor fetches the names, salaries, and commissions of all salespeople, displays the results, then closes the cursor.

The EMP table needs to exist for this program to work.

  getempPROC.pc This Pro*C sample program prompts the user for an employee number and then:

- Queries the emp table for the employee's name, salary and commission.
- Uses indicator variables (in an indicator struct) to determine if the commission is NULL.

The employee numbers can be found by running the Pro*C batchfetchPROC sample program or via the EMP table.

The EMP table needs to exist for this program to work.

  plsqlPROC.pc This sample program uses Pro*C to access common PL/SQL packages (emp_pkg and sample_pkg) in four different ways:

- Calls a stored procedure with IN and OUT parameters
- Calls a stored function with IN and OUT parameters
- Calls an anonymous block and passes host variables into and out of the block
- Calls a store procedure to open a ref cursor and uses Pro*C to process the result-set of the ref cursor

The EMP table and the emp_pkg and sample_pkg PL/SQL packages need to exist for this program to work.

Compile and Run: learn how to compile and run the sample programs on your installed platform.

For more information on Pro*C/C++ support in TimesTen,, refer to the Pro*C/C++ chapter in the Oracle TimesTen In-Memory Database C Developer's Guide.