rem 
rem $Header: oci18.sql 10-jan-97.13:43:25 echen Exp $ 
rem 
Rem  Copyright (c) 1995, 1997 by Oracle Corporation 
Rem    NAME
Rem      oci18.sql
Rem    DESCRIPTION
Rem	 Script for A22400 OCI Techniques White Paper
Rem      Demo script for oci18.c
Rem    MODIFIED   (MM/DD/YY)
Rem     cchau      08/18/97 -  enable dictionary protection
Rem     echen      01/10/97 -  change internal to sys/change_on_install
Rem     vraghuna   03/01/95 -  Creation

set echo on;
connect internal
drop user ocitest cascade;
create user ocitest identified by ocitest;
grant connect,resource to ocitest;
connect ocitest/ocitest;

create table oci18tab (col1 varchar2(30));
 
create or replace package oci18pkg as

	type char_array is table of varchar2(30) index by binary_integer;

	function oci18func(
		col1      in char_array,   -- array to put cname in 
		numins    in integer)
	return integer;

end;
/

create or replace package body oci18pkg as


	function oci18func(
		col1      in char_array,
		numins    in integer
	) return integer is retval integer;

	begin

		for i in 1..numins loop
			insert into oci18tab values (col1(i));
		end loop;
		commit;

		retval := numins;
		return(retval);

	end;

end;
/

commit;
 
