Hello,
I have a unix shell script that generates unix shell arrays and I want to load those arrays's values into an Oracle 8i database from the same script, but cannot correctly access them from sqlplus.
I am looking for something like (this is a simplified script that has the same problem):
#!/usr/bin/ksh
...
array1[0]="text1"
array1[1]="text1"
array1[2]="text2"
array1[3]="text3"
...
SQL="/oracle817/bin/sqlplus user/password"
$SQL <<finish
set pagesize 0
set linesize 800
set colsep ','
set feedback off
set serveroutput on
variable var1 varchar2( 100 );
begin
:num1 := 0;
while :num1 < 3 loop
:var1 := ${array1[:num1]};
:num1 := :num1 + 1;
end loop;
end;
/
print var1;
finish
...
...
I can access the unix array if the array_element_number is specified "manually". But I can't get it working when this array_element_number is dinamically set on the sql loop.
Any ideas. Thanks in advance,
jmiturbe
I have a unix shell script that generates unix shell arrays and I want to load those arrays's values into an Oracle 8i database from the same script, but cannot correctly access them from sqlplus.
I am looking for something like (this is a simplified script that has the same problem):
#!/usr/bin/ksh
...
array1[0]="text1"
array1[1]="text1"
array1[2]="text2"
array1[3]="text3"
...
SQL="/oracle817/bin/sqlplus user/password"
$SQL <<finish
set pagesize 0
set linesize 800
set colsep ','
set feedback off
set serveroutput on
variable var1 varchar2( 100 );
begin
:num1 := 0;
while :num1 < 3 loop
:var1 := ${array1[:num1]};
:num1 := :num1 + 1;
end loop;
end;
/
print var1;
finish
...
...
I can access the unix array if the array_element_number is specified "manually". But I can't get it working when this array_element_number is dinamically set on the sql loop.
Any ideas. Thanks in advance,
jmiturbe