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!

How to Fetch the Blob column from SQLPLUS Through a shell script

3189006Feb 23 2017 — edited Mar 2 2017

Hi,

Hi I am Trying to fetch a BLOB column

I am Trying to fetch a BLOB column from a table and send out an email with BOLB file as an attachment through the shell script.

However my script is failing for some reason.Kindly help me in this regard.

Below is the sudo code.

VATT=`sqlplus -s $P_Login<< !EOF

      set feedback off;

      set echo on;

      set verify on;

      set pages 0

      set serveroutput on size 1000000

      set linesize 10000

      DECLARE

     l_image  BLOB;

      BEGIN

    

    SELECT  ATTACHMENT

           INTO  l_image

           FROM  table

          WHERE     1=1

          AND PROCESS_ID='$p_process_id';

             

      EXCEPTION

        WHEN OTHERS THEN dbms_output.PUT_LINE('*****Error is : '||sqlcode ||' '||sqlerrm);

      END;

      /

exit;

!EOF`

echo -e "$p_email_body" | mutt -s "p_subject $v_sid "  $p_to_email -a $VATT".pdf"

Thanks you advance!

Regards,

SAM

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2017
Added on Feb 23 2017
4 comments
1,954 views