Oracle8i SQL Reference
Release 2 (8.1.6)

A76989-01

Library

Product

Contents

Index

Prev Up Next

SQL Statements (continued), 2 of 6


CALL

Syntax


Purpose

Enables you to execute a routine (a standalone procedure or function, or a procedure or function defined within a type or package) from within SQL. For information on creating such routine, refer to PL/SQL User's Guide and Reference.

Prerequisites

You must have EXECUTE privilege on the standalone routine or on the type or package in which the routine is defined.

Keywords and Parameters

schema 

specifies the schema in which the standalone routine (or the package or type containing the routine) resides. If you do not specify schema, Oracle assumes the routine is in your own schema. 

type or package 

specifies the type or package in which the routine is defined. 

function | procedure | method 

specifies the name of the function or procedure being called, or a synonym that translates to a function or procedure.

When you call a type's member function or procedure, if the first argument (SELF) is a null IN OUT argument, Oracle returns an error. If SELF is a null IN argument, Oracle returns null. In both cases, the function or procedure is not invoked.

Restriction: If the routine is a function, the INTO clause is mandatory. 

@dblink 

in a distributed database system, specifies the name of the database containing the standalone routine (or the package or functioning containing the routine). If you omit dblink, Oracle looks in your local database. 

expr 

specifies one or more arguments to the routine.

Restrictions:

  • An expr cannot be a pseudocolumn or either of the object reference functions VALUE or REF.

  • Any expr that is an IN OUT or OUT argument of the routine must correspond to a host variable expression.

 

INTO :host_variable 

applies only to calls to functions. This parameter specifies which host variable will store the return value of the function. 

:indicator_variable 

indicates the value or condition of the host variable.

See Also: Pro*C/C++ Precompiler Programmer's Guide for more information on host variables and indicator variables. 

Example

The following statement creates a procedure UPDATESALARY, and then calls the procedure, which updates the specified employee ID with a new salary.

CREATE OR REPLACE PROCEDURE updateSalary
   (id NUMBER, newsalary NUMBER) IS 
   BEGIN 
      UPDATE emp SET sal=newsalary WHERE empno=id; 
   END; 

CALL updateSalary(1404, 50000); 


Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index