Page 1 of 1

How to insert some DUMMY value to BLOB field

PostPosted: Tue Jun 07, 2016 10:45 pm
by hariharan_bk
Hi All,

Lets consider table A has 5 columns and i need to insert a row here.

For COL1 - 4, we have the data
and for col - 5 which is a BLOB field and is declared as NOT NULL, we dont have any data from input sources. Our requirement is to insert some dummy values into this BLOB field for now. I have tried many ways to insert dummy fields into this field .. and all in vain.

BLOB(X'123')
cast(x'000001' as blob) and so many...



INSERT INTO DATA_BLOB_DUMMY     
     (                            
       COL1, COL2, COL3, COL4              
      , BLOB_FIELD                
     )                            
VALUES                            
     (                            
      :COL1
,      :COL2
,      :COL3
,      :COL4        
    ,BLOB('000001')    
 


Please help me how to get an entry in this table with some value for BLOB?

Re: HOW TO INSERT SOME DUMMY VALUE TO BLOB FIELD

PostPosted: Wed Jun 08, 2016 3:40 pm
by hariharan_bk


01  WS-IN-BLOB USAGE IS SQL TYPE IS BLOB(1048576).      <--- declared this WS variable.... internnaly this is handled as VARCHAR..... so we need to pass actual length and data to the variables as shown below....
....

MOVE 10                      TO WS-IN-BLOB-LENGTH
MOVE 'DUMMY DATA'                                
                             TO WS-IN-BLOB-DATA  
....

INSERT INTO DATA_BLOB_DUMMY      
     (                            
       COL1, COL2, COL3, COL4              
      , BLOB_FIELD                
     )                            
VALUES                            
     (                            
      :COL1
,      :COL2
,      :COL3
,      :COL4        
,      :WS-IN-BLOB    <-------
  )            


 



this worked, Thanks