Hi
Simple thing has been driving me nuts. I have used the following code is ksh scripts to get data from Oracle table and then display it, allowing user to select one of the data options returned...
REP_DATA=\`sqlplus -s $\{WMSDB\} <<EOF
SET SERVEROUTPUT ON FEEDBACK OFF VERIFY OFF ECHO OFF HEADING OFF
SELECT ACTIVITY_ID, ACTIVITY_NAME
FROM ACTIVITY;
exit;
EOF\`
\#get data into array
set -A temp_arr $\{REP_DATA\};
\#for each entry in the array, launch a process
x=0
while [ $x -lt $\{\#temp_arr[*]\} ]
do
\# extract the name and process flag status from the array
echo "$x\\t$\{temp_arr[x]\}";
let x=x\+1;
done;
echo "Select the Activity you are working on: \\c"
read ACT_ID
...
Normally this stuff is fine but now I have the problem that the ACTIVITY_NAME field has spaces in...
ACTIVITY_ID ACTIVITY_NAME
101 Badminton
202 Sailing
203 Abseiling and Climbing
301 Painting, Drawing and Sketching
So the set -A command ends up in an array of...
(101,Badminton,202,Sailing,203,Abseiling,and,Climbing,301,Painting,,Drawing,and,Sketching)
I tried to wrap the ACTIVITY_NAME using double quotes (i.e. SELECT ACTIVITY_ID, '"' || ACTIVITY_NAME || '"') in the SQL in the hope that UNIX would treat it as one string but it didn;t work.
Any guidance would be appreciated.
Thanks