Functions

A function in Oracle is the same thing as it is in SQL Server: a program to return some value. In general, the functions in Oracle are scalar-valued functions. They return a value to what called the function. In contrast, stored procedures do not return anything. Table 9-4 summarizes function types in SQL Server and Oracle.

Coding functions is similar to creating procedures. Functions can take input parameters and handle errors, but they always return a value. Here is an example of a simple function that takes in some parameters and returns a value:

Image

TABLE 9-4. Function Types in SQL Server and Oracle

SQLPLUS> create or replace function ...

Get Oracle Database Administration for Microsoft SQL Server DBAs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.