Remove spaces / tabs from variable in script

I want to remove extra spaces from variable in aix script.
We retrieve the data from oracle database and then print the values. We have a value on 90th position.
When we execute the query on sqlplus it shows the length of 90th position as 3, but when we use the same query in aix script it shows the length as 158. Kindly advice how can we remove the extra spaces.
I tried as

 parm=` $90 | tr -d ''`
 parmlen=length(parm)

but on execution the script received below error:

Syntax Error The source line is 7.
 The error context is
                         >>>    parm=` <<<
 awk: 0602-502 The statement cannot be correctly parsed. The source line is 7.
$ echo -e "\t   hello"
           hello
$ echo -e "\t   hello" | sed "s/[ \t]//g"
hello

Looks like you are mixing up shell with awk.
Shell does not know about $90. In awk this would be field $90, yes.
On the other side defining a shell variable which's name is consisting only of numeric characters does not work, so you are definetly mixing up things.
Also the function length() is an awk function.

I don't understand if you already extracted field 90 and it has a lot of spaces in it so it produces a length of 158 instead of 3 or if you have a complete line where field 90 is not even extracted yet?

Maybe post the line using code tags and tell if you only want to measure it's length or also get it's output printed, thanks.

My apologies to did not mentioned that we are using awk in the script.

awk 'BEGIN { FS="\t" ; linewidth=80 } {
    if ( NR == 3 ) {
        num=sprintf("%010d", $2)
        numstr=sprintf("%s-%s", substr(num,1,6), substr(num,7,4))
        parm=` $90 | tr -d ''`
        parmlen=length(parm)

The output is in a single line and $90 also extract with value YES that displays correctly when we do need tried to remove the sapces

 printf("          SET TEMP Test: %5.5s %-2.3s",parmlen,parm)

Actually I am facing a problem using if condition to check the value of $90 field as below:

 if ( parm == "YES" )
            printf("          SET TEMP: %5.5s %-2.2s", $51, $52)
        else
           printf("          SET TEMP Test: %5.5s %-2.3s",parmlen,parm)

The value display thru above printf is YES but the length is 158. My condition always fails and print the line after else.

Kindly advice.

---------- Post updated at 12:24 PM ---------- Previous update was at 12:16 PM ----------

After that I change the coding to remove spaces as below

awk 'BEGIN { FS="\t" ; linewidth=80 } {
    if ( NR == 3 ) {
        num=sprintf("%010d", $2)
        numstr=sprintf("%s-%s", substr(num,1,6), substr(num,7,4))
        parm=$90
        parm=$(print "$parm" | nawk '{gsub(/^[ ]*/,"",$0); gsub(/[ ]*$/,"",$0) ; print }')
        parmlen=length(parm)

the above returned below error:

0403-057 Syntax error at line 125 : `(' is not expected

Try with this ..

parm=$(print "$parm" | nawk '{$1=$1};1')

This command also generate the error and the complete output converted into garbage.
The error is as below:

 
 Syntax Error The source line is 6.
 The error context is
                         >>>    parm=$(print <<<  "$parm" | nawk {05399274=05399274}
 awk: 0602-502 The statement cannot be correctly parsed. The source line is 6.
        awk: 0602-541 There are 2 missing } characters.
        awk: 0602-540 There is a missing ) character.

---------- Post updated at 02:13 PM ---------- Previous update was at 01:08 PM ----------

My problem has been resolved as I used substr function to get 3 characters only as below:

 parm=$90
 parm= substr(parm,1,3)