Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
41
Добавлен:
16.04.2013
Размер:
4.96 Mб
Скачать

Executing External Procedures with the CALL Statement

WITH CONTEXT

By including the WITH CONTEXT clause, you can give an external procedure access to information about parameters, exceptions, memory allocation, and the user environment. The WITH CONTEXT clause specifies that a context pointer will be passed to the external procedure. For example, if you write the following PL/SQL function:

CREATE OR REPLACE FUNCTION getNum_func ( x IN REAL)

RETURN BINARY_INTEGER AS LANGUAGE C LIBRARY c_utils

NAME "C_getNum" WITH CONTEXT PARAMETERS (

CONTEXT,

x BY REFERENCE, RETURN INDICATOR);

Then, the C prototype would be:

int C_getNum(

OCIExtProcContext *with_context, float *x,

short *retind);

The context data structure is opaque to the external procedure; but, is available to service procedures called by the external procedure.

If you also include the PARAMETERS clause, then you must specify the parameter CONTEXT, which shows the position of the context pointer in the parameter list. If you omit the PARAMETERS clause, then the context pointer is the first parameter passed to the external procedure.

Inter-Language Parameter Mode Mappings

PL/SQL supports the IN, IN OUT, and OUT parameter modes, as well as the RETURN clause for procedures returning values.

Executing External Procedures with the CALL Statement

Now that you have published your Java class method or external C procedure, you are ready to invoke it.

Calling External Procedures 8-33

Соседние файлы в папке Oracle 10g