0
votes

I am using oracle 11g on ubuntu 14.04LTS. I have a table called members which I created by the following sql,

 create table members(
    mem_id int,
    issue_date date,
    expire_date date,
    book_count int,
    fine float(2),
    mem_pic bfile,
    CONSTRAINT mem_const PRIMARY KEY (mem_id)
 );

Later on I have updated the table like this,

alter table members add( mem_pic bfile ) ;

Now when I run "DESC members" it shows the result,

Name                     Null?    Type
 ----------------------------------------- -------- ----------------------------
 MEM_ID                  NOT NULL NUMBER(38)
 ISSUE_DATE                       DATE
 EXPIRE_DATE                      DATE
 BOOK_COUNT                       NUMBER(38)
 FINE                             FLOAT(2)
 MEM_PIC                          BINARY FILE LOB

Finally I run a insert sql like this,

SQL> insert into members( MEM_id ,MEM_PIC ) values(4,utl_raw.cast_to_raw('/home/pictures/images.jpeg')); 

It shows the error,

ERROR at line 1: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

Can anybody help me where is the problem. And I am also not sure weather in this process I can add the binary file of the image or the path.Can anybody help me on that how I can update my table with the image from the following path.

1

1 Answers