Oracle PL/SQL - Pass parameter by reference

Introduction

You can give the compiler a hint that reference memory management could be used.

This is useful to pass a large amount of data in a procedure:

Demo

SQL>
SQL> create or replace procedure p_validate(io_string_tx IN OUT NOCOPY VARCHAR2)
  2  is-- from w w w.  j av  a  2 s  . c  o  m
  3       v_invalid_tx VARCHAR2(8):='test';
  4  begin
  5       io_string_tx:=replace (io_string_tx,v_invalid_tx);
  6       if length(io_string_tx)>4000
  7       then
  8             io_string_tx:=substr(io_string_tx,1,3997)||'...';
  9       end if;
 10  end;
 11  /

Procedure created.

SQL>

Here, it passes the parameter with the hint NOCOPY.

This hint is applicable only to OUT and IN OUT types of variables.

Related Topic