简体   繁体   中英

Copying blob column contents from one table to another in Oracle Apex

I'm currently trying to copy the contents of a blob column from one table to another in Oracle Apex 5 and no matter what, it doesn't copy the BLOB data over, it leaves all those fields blank and it's driving my nuts.

Here is the PL/SQL I'm using to accomplish this as a process.

insert into ATTACHMENTS_AVAIL 
  ("ADDED_FILE", "MIMETYPE", "FILENAME", "CONTRACTOR_ID", "DATE_ADDED", "TYPE") 
select RESUME,
       MIMETYPE,
       FILENAME,
       :P24_CONTRACTOR_ID,
       sysdate,
       'Resume'
from subs 
where pkey = :P24_SUBS_PKEY;

Any idea what I'm missing here?

Here are the field types.

ADDED_FILE    - BLOB
MIMETYPE      - VARCHAR2
FILENAME      - VARCHAR2
CONTRACTOR_ID - NUMBER
DATE_ADDED    - DATE
TYPE          - VARCHAR2

(...) it leaves all those fields blank

It means that WHERE clause failed, completely:

  • either there's no SUBS.PKEY whose value is equal to P24_SUBS_PKEY item value, or
  • P24_SUBS_PKEY is empty

How come? Because, even if every other value was NULL, SYSDATE (you insert into DATE_ADDED ) and 'Resume' (which goes into TYPE column) would be inserted. So, INSERT failed because SELECT failed because WHERE doesn't work.

I presume you checked whether SUBS table contains appropriate values. Therefore, I presume that P24_SUBS_PKEY item doesn't contain anything. Perhaps you see the value on the screen, but - is it in session state? I guess not. Enable debugging and check the sessions state values after the process ends.

Saying that you wrote a process which should do the INSERT - when does that process "fire"? The simplest way is, probably, when you push a button which submits the page. And, once you submit it, items' values are "stored" into session state. I suggest you to do that, just to make sure it actually works. Then you can improve the whole thing, if necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM