Skip to main content

I can resolve this problem, but I don't understand, why happen this..it happens.

    1st step: Query a number from a DB with sqlplus,
    2nd step: Format some text for a mail,
    3rd step: send a mail with these
  • 1st step: Query a number from a DB with sqlplus,
  • 2nd step: Format some text for a mail,
  • 3rd step: send a mail with these.

psnr() { sqlplus -s USR/PASS@PROD << EOS SET PAGESIZE 0 SET COLSEP ";" SET FEEDBACK OFF SET TRIMOUT ON SET TRIMSPOOL ON select max_number-last_number from postalslip where state = 'OPEN' / exit / EOS }

psnr() {
sqlplus -s USR/PASS@PROD << EOS
SET PAGESIZE 0
SET COLSEP ";"
SET FEEDBACK OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
  select max_number-last_number from postalslip
  where state = 'OPEN'
/
exit
/
EOS
}

PSNR=$(psnr)

PSNR=$(psnr)

echo "Today's result is: $PSNR" > $MAILTMP

echo "Today's result is: $PSNR" > $MAILTMP

od -c mailtmp.17872.txt 0000000 T o d a y ' s r e s u l t i 0000020 s : \t 1 2 3 4 5 0000040 6 7 \n 0000043

od -c mailtmp.17872.txt
0000000   T   o   d   a   y   '   s       r   e   s   u   l   t       i
0000020   s   :      \t                               1   2   3   4   5
0000040   6   7  \n
0000043

That damned tab '\t' is what I don't understand: where does it comescome from. from, from sqlplus? Possibly Possibly DB specificity? (I checked in TOAD, both coloumns are number(18) Maybe. Maybe the funcitonfunction in ksh have some special featuresfeatures?

Thank you all answers in advance and sorry for my english.

I can resolve this problem, but I don't understand, why happen this...

    1st step: Query a number from a DB with sqlplus,
    2nd step: Format some text for a mail,
    3rd step: send a mail with these

psnr() { sqlplus -s USR/PASS@PROD << EOS SET PAGESIZE 0 SET COLSEP ";" SET FEEDBACK OFF SET TRIMOUT ON SET TRIMSPOOL ON select max_number-last_number from postalslip where state = 'OPEN' / exit / EOS }

PSNR=$(psnr)

echo "Today's result is: $PSNR" > $MAILTMP

od -c mailtmp.17872.txt 0000000 T o d a y ' s r e s u l t i 0000020 s : \t 1 2 3 4 5 0000040 6 7 \n 0000043

That damned tab '\t' what I don't understand where it comes from. from sqlplus? Possibly DB specificity? (I checked in TOAD, both coloumns are number(18) Maybe the funciton in ksh have some special features?

Thank you all answers in advance and sorry for my english.

I can resolve this problem, but I don't understand why it happens.

  • 1st step: Query a number from a DB with sqlplus,
  • 2nd step: Format some text for a mail,
  • 3rd step: send a mail with these.
psnr() {
sqlplus -s USR/PASS@PROD << EOS
SET PAGESIZE 0
SET COLSEP ";"
SET FEEDBACK OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
  select max_number-last_number from postalslip
  where state = 'OPEN'
/
exit
/
EOS
}
PSNR=$(psnr)
echo "Today's result is: $PSNR" > $MAILTMP
od -c mailtmp.17872.txt
0000000   T   o   d   a   y   '   s       r   e   s   u   l   t       i
0000020   s   :      \t                               1   2   3   4   5
0000040   6   7  \n
0000043

That tab '\t' is what I don't understand: where does it come from, from sqlplus? Possibly DB specificity? (I checked in TOAD, both coloumns are number(18). Maybe the function in ksh have some special features?

Source Link
Apex
  • 3
  • 1
  • 3

removing all tabs in sqlplus

I can resolve this problem, but I don't understand, why happen this...

My task is: (in ksh)

    1st step: Query a number from a DB with sqlplus,
    2nd step: Format some text for a mail,
    3rd step: send a mail with these

This is a part of my code:

psnr() { sqlplus -s USR/PASS@PROD << EOS SET PAGESIZE 0 SET COLSEP ";" SET FEEDBACK OFF SET TRIMOUT ON SET TRIMSPOOL ON select max_number-last_number from postalslip where state = 'OPEN' / exit / EOS }

I got a number, 1234567, when I call this function.

PSNR=$(psnr)

I write a word for a mail:

echo "Today's result is: $PSNR" > $MAILTMP

if I want to use this variable MAILTMP I must use tr -d '\040\011' what I found here, in stackexchange, 'cause the result without tr will be this:

od -c mailtmp.17872.txt 0000000 T o d a y ' s r e s u l t i 0000020 s : \t 1 2 3 4 5 0000040 6 7 \n 0000043

That damned tab '\t' what I don't understand where it comes from. from sqlplus? Possibly DB specificity? (I checked in TOAD, both coloumns are number(18) Maybe the funciton in ksh have some special features?

Thank you all answers in advance and sorry for my english.