Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL SQL output to shell variable coming in formatted way but the variable output to mail is not comin

892574Apr 26 2015

Hi All,

                  I am new to pl/sql and i have used one pl sql procedure and i am calling this procedure in shell script. When i capture the pl sql output to file it is coming in formatted way but if i send the same output to mail in linux that ouput is not coming in formatted way...what ever the output i am getting from linux commands those lines are coming in formatted way in mail. i am suspecting that i need to add some thing in pl sql procedure to avoid extra spaces. could any one please suggest.

pl/sql procedure -- dbtime.sql

============

set feedback off

set serveroutput on size 1000000

declare

        x date;

begin

    select startup_time into x from v$instance;

    dbms_output.put_line( 'Instance Status                                  : Up since '||x);

end;

/

shell script -- dbtime.sh

=============

run_sql () {

sql_output=`sqlplus -S '/ as sysdba'  <<EOF

set feedback off verify off pages 0 lines 1000

$sql_command

EOF

`

}

ouput =/tmp/ouput.log

run_sql '@dbtime.sql' > $output

If i execute the shell script dbtime.sh i see below ouput in ouput.log file

Instance Status                                   : Up since 20-APR-15.

when i send the file content to mail in linux using  i am getting ouput in mail like below

Instance Status                                                                     : UP since 20-APR-15

The main problem here is formate what every the formate i am getting in ouput.log file the same formate i am not getting in mail this is happening only for the ouput lines which i am getting trough pl/sql.

could any one please suggest and provide me your inputs.

Please rout it to correct forum group if i created in any wrong group.

Thanks in advance...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2015
Added on Apr 26 2015
0 comments
285 views