GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • V8.x Documentation
  • Privacy Statement
  • License Agreement
  • Contact Us

This view

  • Original page
  • New address

GeezerVison is showing docs.voltdb.com — 8.4. Invoking User-Defined Functions in SQL Statements

  • Volt Active Data
  • Feedback/Discuss
  • Books
    • VoltDB Tutorial
    • Using VoltDB
    • VoltDB Guide to Performance and Customization
    • VoltDB Planning Guide
    • VoltDB Administrator's Guide
    • VoltDB Quick Reference
  • Current docs ▶
  • VoltDB V8 LTS
    • VoltDB V16
    • VoltDB V15.3 LTS
    • VoltDB V14.3 LTS
    • VoltDB V13.3 LTS
    • VoltDB V12.3 LTS
    • VoltDB V11.4
    • VoltDB V10.2
    • VoltDB V9.3
8.4. Invoking User-Defined Functions in SQL Statements

Documentation

VoltDB Home » Documentation » Guide to Performance and Customization
< previoustable of contentsnext >

8.4. Invoking User-Defined Functions in SQL Statements

Once the class is loaded and the function declared, you can include the user-defined function in SQL queries and data manipulation (DML) statements just as you normally use built-in functions in SQL. For example, if a stored procedure needs to convert an entry in miles to the equivalent measurement in kilometers, the stored procedure definition might look like the following:

CREATE PROCEDURE Expense_in_miles AS
    INSERT INTO Expense_item (item_name, distance, destination)
    VALUES (?, US2METRIC(?,'MILES'), ?);

Note that user-defined functions can be used in queries and DML but cannot be used in data definition statements, such as CREATE statements that define indexes, tables, or views.

< previoustable of contentsnext >
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.