Write the BLOB in a table
I have a page where users download files in a custom table (contents of the file as BLOB store). I use wwv_flow_files to select from a page process to insert in my custom table. For some reason, the insert does not create a file. If I try to select in wwv_flow_files, I don't see anything.Am I missing something?
Here is my table:
report_layout
PK_ID NOT NULL VARCHAR2 (32)
FK_FORM VARCHAR2 (32)
REPORT_LAYOUT VARCHAR2 (30)
REPORT_LAYOUT_DESC VARCHAR2 (50)
REPORT_QUERY VARCHAR2 (30)
NAME VARCHAR2 (255)
MIMETYPE VARCHAR2 (255)
BLOB OBJECT MODEL
On my page, I have 'FILENAME' and 'MIME Type' set to hidden and 'MODEL' the value leader go. I have created a process that only inserts the record:
Start
get_pk: = sis_express.get_sys_guid ();
BEGIN
Insert in "#OWNER #".report_layout ".
(pk_id, fk_form, report_layout, report_layout_desc, report_query, file name, MIME type, model)
Select get_pk,
: P539_FK_FORM,.
: P539_REPORT_LAYOUT,.
: P539_REPORT_LAYOUT_DESC,.
: P539_REPORT_QUERY,.
file name,
mime_type,
blob_content
of wwv_flow_files
where filename =: P539_FILENAME;
-EXCEPTION when dup_val_on_index then null;
END;
END;
«In my page, I have 'FILENAME' and 'MIME Type' set to hidden and 'MODEL' the value leader go.» "I have created a process that only inserts the record:
«.. . from wwv_flow_files
where filename =: P539_FILENAME; »
What should we not
of wwv_flow_files
where filename =: P539_TEMPLATE
?
See this example on how to manage download / download:
http://Apex.Oracle.com/pls/OTN/f?p=31517:15
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
-------------------------------------------------------------------
Tags: Database
Similar Questions
-
Write the blob value in a file
Hi all
I'm looking on the correct method of writing a blob value to a file. I know the best way to use an external language. For example, Java or C. But also, I met a number of solutions to do within pl/SQL block. All of them look like this:
CREATE OR REPLACE PROCEDURE Write_Binary_file
(
PC$ Directory IN VARCHAR2
, PC$ file_name IN VARCHAR2
, PC$ SQL_Order IN VARCHAR2
, PB$ Raise IN DEFAULT BOOLEAN FALSE
)
-- -------------------------------------------
-Procedure to empty a BLOB column in a file
-- -------------------------------------------
-settings:
-PC$ Directory: name of an existing directory of Oracle
-PC$ file_name: name of the file output expected
-PC$ SQL_Order: SQL command to select the BLOB column
-PB$ Raise: boolean to indicate if the process
-would be stopped after an error
--
IS
src_lob BLOB;
RAW buffer (16384).
AMT directory: = 16384;
INTEGER POS: = 1;
LF$ FicOUT UTL_FILE. TYPE_DE_FICHIER;
LC$ Msg VARCHAR2 (2000);
BEGIN
-get the BLOB column-
BEGIN
EXECUTE IMMEDIATE PC$ SQL_Order IN src_lob;
EXCEPTION
WHEN NO_DATA_FOUND THEN
LC$ Msg: = ' Write_Binary_File(): NO_DATA_FOUND';
If PB$ increase THEN
RAISE_APPLICATION_ERROR (-20100, LC$ Msg);
END IF;
Dbms_Output.put_line(LC$MSG);
RETURN;
END;
-Open the output file-
LF$ FicOUT: = UTL_FILE. FOPEN (Directory$ PC, PC$ filename, 'W', 32764);
-write the file-
LOOP
-play songs-
Dbms_Lob.read (src_lob, amt, pos, buffer);
-write the songs-
Utl_File.Put_Raw (LF$ FicOut, buffer);
POS: = pos + amt;
END LOOP;
-Close the file-
Utl_File.fclose(LF$FicOut);
EXCEPTION
WHEN NO_DATA_FOUND THEN
UTL_FILE.fclose(LF$FicOut);
WHILE OTHERS THEN
LC$ Msg: = ' error Write_Binary_File(): ' | TO_CHAR (SQLCODE) | "everything by managing the file (')"
|| PC$ Directory | ') ' || PC$ file_name;
If PB$ increase THEN
RAISE_APPLICATION_ERROR (-20100, LC$ Msg);
END IF;
Dbms_Output.put_line(LC$MSG);
END Write_Binary_file;
/
But this code doesn't seem to work. The problem is that it always creates a slightly bigger than an initial file. So copy jpg will never be opened with any viewer.
Can someone explain this problem and give no work around?
Thank youHello
If I look at this procedure, I think that you forget to check if the last part, it takes to read is less than 32000. Now you put the always full buffer to the desired quantity. The last part, you only need to read from the BLOB what remains, nothing more. By reading more, get your blob of larger than expected.
I use the package lie on this page for several years and no complains: http://www.adp-gmbh.ch/blog/2005/november/20.html
Herald tiomela
http://htendam.WordPress.com -
Copy all the BLOBs from one table to another
Hi all
I hope that I put in the right place. I am trying to copy from one table to the other BLOBs, but were usuccessful. Here is the script that I wrote to do, but it just loaded a field saying not supported. Is there something I'm missing, I'm using the APEX 3.1.2.
Thanks for your help.
DECLARE
number of v_id;
v_document blob.
v_filename varchar2 (200);
v_mimetype varchar2 (200);
CURSOR c_Document IS
SELECT id, name of the document file, mimetype
IN v_id, v_document, v_filename, v_mimetype
OF CAB_APPEAL_ACTIONS
WHEN THE DOCUMENT IS NOT NULL;
BEGIN
FOR r_Document in c_Document
LOOP
INSERT INTO CAB_APPEAL_DOCUMENTS
(APPEAL_ACTION_ID,
DOCUMENT,
FILE NAME,
MIMETYPE
)
VALUES
(v_id,
v_document,
v_filename,
v_mimetype
);
END LOOP;
END;In addition, what is wrong with just...
INSERT INTO CAB_APPEAL_DOCUMENTS (APPEAL_ACTION_ID, DOCUMENT, FILENAME, MIMETYPE) SELECT id, document, filename, mimetype FROM CAB_APPEAL_ACTIONS WHERE DOCUMENT IS NOT NULL;
APEX will end process page in a BEGIN block... END; block anyway.
See you soon
Ben
-
How to write the raw buffer grabber (table 2D) image to PC memory?
Hello
I use a library C++ and NIImaq to save table raw image 2D on PC.
I have a PCI-1428 acquisition card.
Now, I'm writing a 2D framebuffer grab table memory PC I assigned using virtualalloc.
Any way to do it?
Thank you
Travis
Hi Travis,
After further research, I found that you can use the imgSessionCopyBuffer function (see the reference help function OR-IMAQ for more information) to transfer your data from the memory embedded in your designated PC buffer.
Also, you can find more information on how to set up in the developer zone article below Acquisition ring (Versus the system of onboard memory section memory speak your specific question).
Hope that helps!
See you soon,.
-
How to write the suspicion on physical table
Hi all
That's what I read on the creation of index in the physical table
http://download.Oracle.com/docs/CD/E12096_01/books/AdminTool/admintool_PhysicalSetup32.html#wp1054719
The Index indicator tells the optimizer to scan a specified index, rather than a table. The following hypothetical example explains how you can use the Index indicator. You will find queries on the table ORDER_ITEMS is slow. See you the execution plan of the query optimizer and find that the FAST_INDEX index is not used. You create an indicator of Index to force the optimizer to scan the FAST_INDEX index rather than the table ORDER_ITEMS. The syntax of the indicator Index is index (table_name, index_name)...
index (table_name, index_name)
What is the name of the array index in the Admin? I have no clue in the admin. Index created in db name should I give? Or just column name?
Thank youJEP... the name of th index that you want to use the table
KR,
A -
Store an Image in the column of type BLOB of a Table
It is about saving an Image file, a temp_photo table.
UNDER LINUX, I created the Directory object.
Step # 1
SQL > create directory MSGS3 as ' / home/HD/om4000/I_MESSAGES ";
Created directory.
Step 2: set up the temp_photo Table.
SQL > create table temp_photo
(
ID NUMBER (3) NOT NULL,
PHOTO_NAME VARCHAR2 (50).
PHOTO BLOB
);
Table created.
Step: 3 this is the procedure that I have created to load the file from the file system of the database.
create or replace PROCEDURE load_file)
number of P_ID,
p_photo_name in varchar2) IS
src_file BFILE.
dst_file BLOB;
lgh_file directory.
BEGIN
src_file: = bfilename ('MSGS3', p_photo_name);
-Insert a NULL record to lock
INSERT INTO temp_photo
(id, photo_name, photo)
VALUES
(p_id, p_photo_name, EMPTY_BLOB())
RETURN photo INTO dst_file;
-lock the folder
SELECT photo
IN dst_file
OF temp_photo
ID WHERE p_id =
AND photo_name = p_photo_name
UPDATE;
-Open the file
DBMS_LOB. FileOpen (src_file, dbms_lob.file_readonly);
-determine the length
lgh_file: = dbms_lob.getlength (src_file);
-Read the file
DBMS_LOB. LoadFromFile (dst_file, src_file, lgh_file);
-update the blob field
UPDATE temp_photo
Photo SET dst_file =
ID WHERE p_id =
AND photo_name = p_photo_name;
-close file
DBMS_LOB. FileClose (src_file);
END load_file;
/
Step 4: when I test it by running the procedure in the following assistance:
SQL > execute load_file (1, 'Omega5000.jpg');
I get the following error:
Error from line 5 in order:
run load_file(1,'Omega5000.gif')
Error report:
ORA-22288: file or LOB FILEOPEN operation failed
No such file or directory
ORA-06512: at "SYS." DBMS_LOB", line 805
ORA-06512: at "HD. Load_file", line 23
ORA-06512: at line 1
22288 00000 - "file or LOB operation %s failed\n%s".
* Cause: Failure of the attempted operation on the file or the LOB.
* Action: See the following error message in the more detailed error stack
information. In addition, make sure that the file or LOB exists and that
privileges are set for the specified operation. If
the error continues, report the error to the user DBA.
He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
Can someone help me where I'm doing something wrong. This is the first time I use the BLOB in my table. Can anyone suggest what's not here.>
He said: no such file or directory, but I double checked that the file is located in the same directory and directory is it physically (for which I created the above directory object.)
>
Oracle is disagreeing with you.Post your proof that the file exists in the path you provided.
See this example Oracle-base
http://www.Oracle-base.com/articles/Misc/HTML-with-embedded-images-from-plsql.php
>
CONN / AS SYSDBA
CREATE or REPLACE DIRECTORY of images AS "/ host /";
GRANT READ, WRITE on DIRECTORY images TO test;
>
Write down everything you missed? Tip: Look at the last character of the DIRECTORY string. Second Tip: See the grant?SQL>create directory MSGS3 as '/home/mh/om4000/I_MESSAGES' ;
-
Write the spreadsheet in an array of strings on a different worksheet
Hello
is it possible to write the spreadsheet to a table of chains, but to an additional worksheet?
I am writing the results of the spreadsheet, but I want to create a different worksheet so that I can put the raw data.
is this possible?
If so, how?
You can't unless you start using ActiveX or report generation tool to connect with a real spreadsheet .xls file.
You are read and write a text file in the form in the way of a spreadsheet with delimiters between values in a row and the lines of text on the other. Text files have no understanding of the data being on a "sheet" and other data on another. It is a peculiarity of the format property of Excel file (and thus other spreadsheets) that allows Excel what data need to be put on what spreadsheet. It is not the kind of information that you can pass along the use of LabVIEW based text file i/o functions.
-
How to write the xml content of a file (Blob data Type) with other columns in file system
Team,
We are currently working on oracle 11 g. Suppose that we consider the SCOTT. EMP table for our creation of the table.
All existing columns of SCOTT along. EMP table allows to assume that this table has an additional column name emp_xml, which is of TYpe of BLOB data and it holds xml data.
the size of the data blob for each record in this col is greater than 32 KB (normally about 1 GB), now I want to write the contents of this column along
with enmae, empno, hiredate into an external file. Assume that if we are only to the BLOB column that is emp_xml then the code below worksStart
for c in (select emp_xml from your_table)
loop
dbms_xslprocessor.clob2file (emp_xml.getclobval (), 'YOUR_LOCATION', 'YOUR_DYNAMIC_FILENAME')
end loop;
end;but I want empno, enmae, hiredate with blob emp_xml written in the external file. Any assistance in this case welcome.
Concerning
max_linesize
Maximum number of characters for each line, including the newline character,
for this file (minimum 1, maximum value 32767). If not specified, Oracle
provides a default value of 1024.Defines how much you can read or write to a single call. I have to loop through the clob object and I write a pieces of 1024. So there is no limit to how much she can write. Just test it, IT will WORK!
-
Access the Blob of Table data and save to file local system
I have a table that has a blob column in which most of the regular file types are downloaded and stored.
What is the best/better way to select/query this table and write all of the content of the BLOB in a local file system?
Using oracle 10.2.
Is it possible to sort the batch and save them on my local drive?
Any help is appreciated.
Thank you.Try to reset the l_pos to 1 for each iteration in your loop of file name:
create or replace procedure save_to_file_third is l_file utl_file.file_type; l_buffer raw(32767); l_amount binary_integer := 32767; l_pos integer := 1; l_blob blob; l_blob_len integer; myfile_name varchar2(250); cursor c1 is select id from security where file_name1 is not null; begin for i in c1 loop -- Get LOB locator select file1, file_name1 into l_blob, myfile_name from security where id = i.id; l_blob_len := dbms_lob.getlength(l_blob); l_pos := 1; --re-init l_pos var -- Open the destination file. l_file := utl_file.fopen('MY_FILES', myfile_name, 'wb', 32767); -- Read chunks of the BLOB and write them to the file -- until complete. while l_pos < l_blob_len loop dbms_lob.read(l_blob, l_amount, l_pos, l_buffer); utl_file.put_raw(l_file, l_buffer, true); l_pos := l_pos + l_amount; end loop; -- Close the file. utl_file.fclose(l_file); end loop; exception when others then -- Close the file if something goes wrong. if utl_file.is_open(l_file) then utl_file.fclose(l_file); end if; raise; end save_to_file_third;
-
Write a Cluster of 2 tables 1 d to the worksheet
Hi, I'm pretty new to Labview and I want to write a cluster of 2 tables 1 d in a spreadsheet, the first table 1 d is for the wavelength (for example: 800, 801, 802, 803,...) and the second table 1 d is amplitude (for example: 0, 20, 100, 30,...). How can I write the cluster in a worksheet in the form:
800, 0 801, 20 802, 100 803, 30 ...
In my current attempt, I get something like:
800, 801, 802, 803 ....... 0, 20, 100, 30........
Try the entry-level transposes in the writing of VI of spreadsheet file.
-
How to write the trigger for update or delete multiple columns in a table?
Hello
I create one in the form of table of sample_emp. In that, every time I want to change of name, team_id, team_leader_id, supervisor_id, manager_id it must store the update-able and old values of those in the job_history table. When I write the trigger for which it shows "ORA-04082 new or the old value not table level triggers. Here is my emp_table. My table also similar job_history like this. Need your help.
Header 1 Header 2 Header 3 Header 4 Header 5 Heading 6 Heading 7 8 header Header 9 EMP_ID EMP_NAME DESIGNATION TEAM_ID TEAM_LEADER_ID EMPLOYEE MANAGER_ID HIRE_DATE RELIEVED_DATE --
Thank you.
Hi Joel,.
Venky_prs wrote:
Hello
I create one in the form of table of sample_emp. In that, every time I want to change of name, team_id, team_leader_id, supervisor_id, manager_id it must store the update-able and old values of those in the job_history table. When I write the trigger for which it shows "ORA-04082 new or the old value not table level triggers. Here is my emp_table. My table also similar job_history like this. Need your help.
Header 1 Header 2 Header 3 Header 4 Header 5 Heading 6 Heading 7 8 header Header 9 EMP_ID EMP_NAME DESIGNATION TEAM_ID TEAM_LEADER_ID EMPLOYEE MANAGER_ID HIRE_DATE RELIEVED_DATE --
Thank you.
You can try something like this given below to complete the historical table on update and delete.
create or replace TRIGGER "CLONE_EMP_UPDATE_DELETE" BEFORE DELETE OR UPDATE ON EMP FOR EACH ROW DECLARE PRAGMA autonomous_transaction; BEGIN INSERT INTO JOB_HISTORY("EMP_ID","EMP_NAME","DESIGNATION","TEAM_ID","TEAM_LEADER_ID","SUPERVISOR_ID","MANAGER_ID" ,"HIRE_DATE","RELIEVED_DATE") VALUES(:OLD.EMP_ID,:OLD.EMP_NAME,:OLD.DESIGNATION,:OLD.TEAM_ID,:OLD.TEAM_LEADER_ID,:OLD.SUPERVISOR_ID, :OLD.MANAGER_ID,:OLD.HIRE_DATE, :OLD.RELIEVED_DATE); COMMIT; END;
Hope this helps you,
Kind regards
Jitendra
-
need help on image blob retriving of table... I need to use the function
I have a single display field and I tried to retrieve a value using the function... The idea of using the BLOB comes from the following example...
http://dgielis.blogspot.in/2008/07/show-blob-of-other-table-in-apex-form.html
I created the following function... has only function display.
"return ' < img src =" "|" APEX_UTIL. GET_BLOB_FILE_SRC('P375_PICTURE',1204,,'inline') | '" />';
but the output is undesirable character
The output is the following
< img src = "" apex_util.get_blob_file? a = 231 & s = 16387884076007 & p = 375 & d = 26249204291254605 & i = 26247831247254566 & p_pk1 = 1204 & p_pk2 = & p_ck = C226897F204BFA329F601AF2ED72ECDA & p_content_disposition = inline "/ >"
Using apex 4.2 db 11g release 2 xe
1204 here are a few magazine_id
Here's my blob table structure
xxx_picture
xxx_no number (10),
BLOB of photo
picture_filename
picture_mimetype
image_last_update
I am able to recover the data via interactivereport but I will lke to recover their data that show only the BLOB field
Can someone please guide. . I could hurt
Thank you
Published by: zycoz100 on April 28, 2013 01:05zycoz100 wrote:
I have a single display field and I tried to retrieve a value using the function... The idea of using the BLOB comes from the following example...
http://dgielis.blogspot.in/2008/07/show-blob-of-other-table-in-apex-form.htmlI created the following function... has only function display.
return '';but the output is undesirable character
The output is the following
To get a displayed item to render in HTML, in the definition section Security value escape special characters notitem.
For a column of the report, ensure that the column attribute text to display as report is report Standard column rather than the default display text (escape special characters).
However in the APEX 4.x, using an element in the Image display and support declarative BLOB is preferable to these manual methods. Images can be formatted using the HTML attributes of the element form of property, or via CSS element.
-
How to write the trigger for update of 2 tables
Hi all
I have 2 tables,
1.lv_data,
It contains the following fields,
2.leave_dataemp_name tot_days guru 18
It contains the following fields,
In the second table, if the data is inserted.emp_name From_date to_date no_of_days remaining_days guru 02/05/2012 03/05/2012 2
the no_of_days will be calculated automatically (from to_date - From_date) + 1,
Here, I need to write the trigger to update the remaining_days column,
First table for all tot_days emp_name is 18 days,
Thus, in the second table every time that the record is inserted.
the remaining_days must be calculated as follows,
remaining_days: = tot_days - no_of_days and this (calculated) value should be updated in the tot_days column in the first table (lv_data).
Example:
2.leave_dataemp_name tot_days guru 18
emp_name tot_daysemp_name From_date to_date no_of_days remaining_days guru 02/05/2012 03/05/2012 2 16 [/code Now the first table should be updated like,
Guru 16
So I need to update to 2 tables,
can someone help me to update these 2 tables through TRIGGER?
Thank you
Kind regards
gurujothi
Edited by: Gurujothi may 1, 2012 19:54It is generally considered bad practice to store the value even in 2 places. You are having the kind of problems that you are experiencing now. It is much easier to store in the main table and get the value from there where you need to show in your forms.
-
How can I write the trigger for the global temporary Table
Hi Grus,
How can I write the trigger for the global temporary Table.
I created the TWG with trigger using the script below.
CREATE A GLOBAL_TEMP GLOBAL TEMPORARY TABLE
(
EMP_C_NAME VARCHAR2 (20 BYTE)
)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE, UPDATE OR INSERT
ON GLOBAL_TEMP
REFERRING AGAIN AS NINE OLD AND OLD
FOR EACH LINE
BEGIN
INSERT INTO VALUES EMPNAME (: OLD.) EMP_C_NAME);
END;
/
trigger was created successfully, but her would not insert EMPNAME Table...
Please guide if mistaken or not? If not wanting to give a correct syntax with example
Thanks in advance,
Arun M MBEGIN INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME); END;
you are referencing old value in insert stmt. BEGIN INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME); END;
then run your app, it works very well...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP ( EMP_C_NAME VARCHAR2(20 BYTE) ) ON COMMIT PRESERVE ROWS; CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP BEFORE DELETE OR UPDATE OR INSERT ON GLOBAL_TEMP REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo'); INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME); dbms_output.put_line(:OLD.EMP_C_NAME); END; / create table EMPNAME as select * from GLOBAL_TEMP where 1=2 insert into GLOBAL_TEMP values('fgfdgd'); commit; select * from GLOBAL_TEMP; select * from EMPNAME; output: 1 rows inserted commit succeeded. EMP_C_NAME -------------------- fgfdgd 1 rows selected EMP_C_NAME -------------------- fgfdgd 1 rows selected
He got Arun
Published by: OraclePLSQL on December 28, 2010 18:07
-
How to write the historical table of the journal using the audit
Hi all
I use the Oracle 11 g database.
There are a lot of people to use it.
So, I want to write the story that all users update the table.
If I use the trigger, the problem is resolved. But I want to use the Audit.
Ex:
--------------------------------------------------------------------------------------------------------------------------
The user | IP | TABLE_NAME | STATUS | DATE OF UPDATE |
--------------------------------------------------------------------------------------------------------------------------
JOHN | 192.168.81.3 | EMPLOYEE | UPDATE | 18/06/2010 |
---------------------------------------------------------------------------------------------------------------------------
MARY | 192.168.81.5 | DEPARMENT. REMOVE | 18/06/2010 |
--------------------------------------------------------------------------------------------------------------------------
Any body help me.
Thiensu2810What your question actually?
Is this a problem of implementation of the AUDIT?
Please, learn more: http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_4007.htm#SQLRF01107Nicolas.
Maybe you are looking for
-
partition created but empty how to restart windows installation of the ISO file?
Hello I partitioned the drive using bootcamp but I didn't have the product key to the House. So I had to cancel Setup to reinstall later. So now I have the product key. Partition is ready to be installed. So what to do now? Can someone help me with t
-
is there a sleep on mac books timer?
so are there?
-
How to find who send emails to everyone in my address of my computer books
My address books are with bigpond, hotmail and yahoo. Emails are sent to all recipients of my computer.
-
can you guys explain the main differences between these two linksys wag325n vs wrt120n Im a user at home and im about to buy one of them. Thank you
-
Smartphones blackBerry how to enable java in my 8900
I can view any video on my 8900 coming from any website, and I can also hear no sound when the file send a sound, which could be the problem, I think it must be the activation of the javascrips, but don't know hoe to do. Or it may be something else,