Example Code

Using Database Stored Procedures, Transactions, and Exceptions for Oracle 8.0.4.

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Database Connectivity Toolkit

Code and Documents

Attachment

Description

In addition to SQL language there is a PL/SQL extension supported by advanced database systems such as Oracle Server or Microsoft SQL Server.

PL stands for Procedural Language and allows you to do text-based programming (LOOPs, IF-THEN statements, etc.). Just as C code has functions stored in source files within a file system, PL/SQL has functions, procedures, and packages stored directly in the respective database.

Note: this example assumes some degree of familiarity with SQL and how to set up udl files.

This example demonstrates how to:
1. Specify connection parameters
2. Use database stored procedures and packages
3. Get return values from stored functions

What this example accomplishes:
1. Connects to a database using the Database Connectivity Toolset VIs.
2. Creates a parameterized query.
3. Set parameters for the query
4. Executes the query
5. Returns values from the query.

See the attached files that include
1. A VI that performs the database operations
2. A picture of the stored procedure
3. A picture of the Oracle table.

NOTE: the example code does not apply to LabVIEW versions 6.0 and newer. The SQL Toolkit was replaced with the Database Connectivity Toolkit. Information on this toolkit can be found at the link below.

Related Links:
LabVIEW Database Connectivity Toolkit, which is now part of LabVIEW Professional

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.