Leandro Toshio Takeda
Leandro Toshio Takeda

Reputation: 1639

Getting values blank from query using SQLPLUS but shell do not get it

I'm doing this with sql plus:

set linesize 9999
set trimspool on
set feedback off
set pagesize 0

spool result.csv

SELECT field1 || ';' || field2 || ';' || field3 || ';' || field4 || ';' || field5 || ';'   
|| field6 || ';' || field7 || ';' || field8  || ';' || field9  || ';' || field10
FROM table
WHERE field1 = '12345';

as you can see the result is:

x;x;x;x;x;x;x;x;;x

as you can see the field9 is blank in the database, so when I do:

while IFS=";" read -r field1 field2 field3 field4 field5 field6 field7 field8 field9 fiedl10
do
case "$field1" in

1)
echo "$field1"
echo "$field2"
echo "$field3"
echo "$field4"
echo "$field5"
echo "$field6"
echo "$field7"
echo "$field8"
echo "$field9"
echo "$field10"

I'm not able to print the $field10. Not even $field9 which is blank but even $field10

This is printing:

x <-field1
x <-field2
x <-field3
x <-field4
x <-field5
x <-field6
x <-field7
x <-field8

Any idea would be helpful! Thanks!

Upvotes: 0

Views: 74

Answers (1)

Phylogenesis
Phylogenesis

Reputation: 7890

If that's a copy/paste from your actual script, field10 is typod as fiedl10.

Upvotes: 2

Related Questions