rem 
rem $Header: oci18.sql,v 1.1 1995/03/05 23:38:46 vraghuna Exp $ 
rem 
Rem  Copyright (c) 1995 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     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;
 
