Download blob function instead of table field
HelloIs it possible to download the content of blob field that are returned by a function?
I can only download blob if the blob is in the column of the table...
Thank you
Vincent
Hi Vincent,.
I think you can download the blob content returned by a function with no problems. In the example below, the get_blob function returns a BLOB, you must specify the name and the mime type and the length of the BLOB is obtained using DBMS_LOB. GETLENGTH. Finally, a call to the wpg_docload.download_file procedure is made. To call the procedure download_file, you can do it through the URL or on a page with a 'branch at PL/SQL procedure' in the point "before Header". More info on this kind of procedure here.
create or replace PROCEDURE "DOWNLOAD_FILE"
(
inID NUMBER
)
AS
vMIME VARCHAR2(48);
vLENGTH NUMBER;
vFILENAME VARCHAR2(2000);
vBLOB BLOB;
BEGIN
vMIME := 'application/octet-stream';
vFILENAME := 'Test.sql';
vBLOB := get_blob(inID);
vLENGTH := DBMS_LOB.GETLENGTH(vBLOB);
owa_util.mime_header(nvl(vMIME, 'application/octet'), FALSE);
htp.p('Content-length: ' || vLENGTH);
htp.p('Content-Disposition: attachment; filename="' || SUBSTR(vFILENAME, INSTR(vFILENAME, '/') + 1) || '"');
owa_util.http_header_close;
wpg_docload.download_file(vBLOB);
END;
Kind regards
Sergio
Tags: Database
Similar Questions
-
Adding a sequence as a default value for a column in a table field
Hi all
APEX 4.2.4. Oracle XE 11.2
I'm trying to add a default value from a sequence to a column in a table field, so he fills when I hit the "Add Row" button...
The reason for this by the way, rather than simply using a sequence database and the trigger on the column (which exists and works very well), is that I try also add detail records to the line when I create, and I can not, I do not have the ID of the parent to the child records.
Looking at the docs, (for example oracle 11 g pl/sql enhancements), I thought I'd have be able to use a PL/SQL expression as to_char (petty_cash_seq. NEXTVAL) or to_number (petty_cash_seq. NEXTVAL) or all that kind of expression that extracts the sequence.nextval, as it became available in PL/SQL on the database
so, Ive tried
TO_CHAR (petty_cash_seq. NEXTVAL) in tabular form attributes - column default / PL/SQL expression and he said ORA-02287: unauthorized number sequence here...
Ive also tried rolling upward in a PL/SQL package, as below:
DECLARE v_seq_value NUMBER; BEGIN select petty_cash_seq. NEXTVAL in the double v_seq_value; return v_seq_value; END;
and I get ORA-00923: KEYWORD not found where expected.
Can anyone help as to why neither of them do not seem to work as an expression / packages in the default type?
or... a simple alternative to get the ID of the next record when I hit 'Add Row' before I can create child folders at the same time...
And I've been mulling over the merits of the master / detail integrity and try to think in an orderly manner to create the mask, add the details without having to first submit the master, then go back and go into details... And put it into context, its a request for costs where users create an expense entry and download copies of their expenses at the same time...
Thank you very much
Richard
Use a combination of AJAX and JavaScript to get the next value in the sequence in a version substituted the line Add.
1. on the page editor, right-click on the Ajax callbacks and select Create.
2. on the next page, select PL/SQL. Do * not * select the tabular presentation. Leave this field blank.
3. name your process, e.g. getNextSequence
4. Add the code (under the DIRECTION of your own names of the object):
DECLARE ln_NextSequence NUMBER := 0; BEGIN SELECT MY_SEQUENCE.NEXTVAL INTO ln_NextSequence FROM DUAL; HTP.P(TO_CHAR(ln_NextSequence)); END;
5. When you look now, you will see that the button Add a line called javascript:addRow (). Remove all this and change the button to be triggered by a dynamic action.
6. create a dynamic action when a click on your button to add a line
7. Add the following JavaScript code to get the new value of the sequence using your AJAX call from above and then place it on the newly added line:
var nextSequenceID; apex.server.process( 'getNextSequence' , {} , { dataType: "text", async: false, complete: function( ajaxResponse ) { nextSequenceID = ajaxResponse.responseText; } }); addRow(); $('td [headers="YOUR_ID_COLUMN_NAME_HERE"] input:last').val(nextSequenceID);
-Joe
-
I have an Apex 5 interactive report on a table with a blob column. I have the updated column to download BLOB and Inline content available. It works fine, but I would like that the file blob to open in a new browser window. I see no way to do it. Is there a way?
Thank you!
RoboMan says:
I have an Apex 5 interactive report on a table with a blob column. I have the updated column to download BLOB and Inline content available. It works fine, but I would like that the file blob to open in a new browser window. I see no way to do it. Is there a way?
1. in the definition of BLOB column, adds a static ID as the "blob-download" for use as a jQuery selector.
2. create a dynamic action after Refresh on the IR region, which inserts an attribute target on the download link:
Event: After refresh
Selection type: Region
Region:
Real Actions
Action: Run the JavaScript Code
Fire on Page load: Yes
Code
$('td[headers="blob-download"] a').attr('target', '_new')
-
Download BLOB via wpg_docload does not
Hello
I installed a new oracle database server and recently installed the 4.1 Apex then transferred my legacy data and applications from the old server.
My new configurations are
My oracle Enterprise Manager displaysOracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
Previously I had Apex 4.0.1 on Apex listener through the Glassfish server and all my applications worked perfectly. But on the new installation of the page that downloads report, via the rtf code generation and it downloaded from the BLOB does not work.Hosts 1 Application Servers 1 OC4J Instances 1 HTTP Server Instances 1
I searched and didn't find any help, but it seems that there is a problem of configuration of DAD. My DAD file looks likeDeclare l_mime varchar2 (255); l_length number; l_file_name varchar2 (2000); l_lob_loc blob; l_rtf clob; l_name varchar2(100); -- conversion variables l_src_offset number := 1; l_dest_offset number := 1; l_lang_ctx number := 0; l_warning varchar2(32767); begin -- get name select 'testrtf' into l_name from dual; -- generate document select :P16_RTF into l_rtf from dual; --:P16_RTF contains rtf code. -- convert to lob dbms_lob.createtemporary(l_lob_loc, false); dbms_lob.converttoblob(l_lob_loc, l_rtf, DBMS_LOB.GETLENGTH(l_rtf), l_dest_offset, l_src_offset, 0, l_lang_ctx, l_warning); l_length := dbms_lob.getlength(l_lob_loc); -- http header owa_util.mime_header('application/rtf', false); htp.p('Content-length: ' || l_length); htp.p('Content-Disposition: attachment; filename="'||l_name||'.rtf"'); owa_util.http_header_close; -- download blob wpg_docload.download_file (l_lob_loc); end;
and I could not find wwv_flow_file_objects$ either. All of the suggestions.<Location /pls/apex> Order deny,allow PlsqlDocumentPath docs AllowOverride None PlsqlDocumentProcedure wwv_flow_file_mgr.process_download PlsqlDatabaseConnectString db:1521:orcl ServiceNameFormat PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8 PlsqlAuthenticationMode Basic SetHandler pls_handler PlsqlDocumentTablename wwv_flow_file_objects$ PlsqlDatabaseUsername APEX_PUBLIC_USER PlsqlDefaultPage apex PlsqlDatabasePassword ****** PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize Allow from all </Location>
Concerning
Sabir
Published by: sabir786 on December 29, 2011 11:37Hi sabir786,
I had exactly the same problem. I went to my request of APEX 4.0 and Oracle 10 g to 4.1 APEX and Oracle 11 g, then all download functions via wpg_docload stopped calling the download dialog box.
Now, I tried some kind of workaround to find the feature.
Rather than use page-processes to call the download functions, I tried to use enforcement procedures (called on request) and it works fine.that is to say:
an application process named 'export' called at the requestStart
(#OWNER) # .f_export
v_EXPTYP =>: P10_EXPORT_TYPE,
v_ID =>: F_PROJEKT_ID
);
end;a button that calls a branch with the following query
APPLICATION_PROCESS = export
f_export is the function that generates the rtf file and in the end, it has the wpg_docload functions to download the file.
Hope it helps you as well.
Concerning -
So, I have a table:
BLOB_TABLE
Number of BLOB_ID automatically triggered (sequence primary key)
BULLETIN BLOB
BULL_FILE VARCHAR (255)
BULL_MIME VARCHAR (255)
DATE OF BULL_LAST_UPDATE
SUPERFORM BLOB
SUPER_FILE VARCHAR (255)
SUPER_MIME VARCHAR (255)
DATE OF SUPER_LAST_UPDATE
When I try to view a BLOB, it will show only the last BLOB responsible for this record.
Can I store two types of BLOB data in a table? It doesn't seem to matter how I even try to show (even using the 'Download' link attached to traverse file).
Or I have to create two tables and link them together (I'd rather not do that if I have to).
Please notify.Hello
Maybe I just misunderstood your question, but on
Apex. Oracle.com
workspace: put
user: guest
Pass: apex1234request blobtest - pass to page 2!
I just download 2 different blobs at once...
---
Take a look at the defs of the ID column (which I have 2 times) - here in the format you add WHICH column to download: DOWNLOAD: BLOBTEST:BULLETIN:ID (for the first id)
concerning
MettePublished by: Mettemusenss on 2010-02-19 10:14
-
Download 64-bit instead of 32-bit elements of adobe first 13
Download 64-bit instead of 32-bit elements of adobe first 13
Available downloadable Setup files:
- Suites and programs: CC 2015 | CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
- Acrobat: DC, XI, X | 9,8 | 9 standard
- First Elements: 13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
- Photoshop Elements: 13 | 12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
- Lightroom: 6| 5.7.1| 5 | 4 | 3
- Captivate: 8 | 7 | 6 | 5.5, 5 | 1
- Contribute: CS5 | CS4, CS3 | 3,2
- FrameMaker: 12, 11, 10, 9, 8, 7.2
Download and installation help links Adobe
Help download and installation to Prodesigntools links can be found on the most linked pages. They are essential; especially steps 1, 2 and 3. If you click on a link that does not have these listed steps, open a second window by using the link to Lightroom 3 to see these "important Instructions".
-
I have Photoshop CS6 extended CD, but my computer will not read. Is it possible to get a digital download to use instead?
-
How to upload an image or a file in flash as a blob in an object table.
How to upload an image or a file in flash as a blob in an object table.
What are all the possible ways, we can do it.A search on the forum (or google) would be my first choice, as this issue appears from time to time.
Then, without the knowledge of your environment (jdev version and battery technology), it is difficult to give a profound response.
All I can say is that it is possible.Timo
-
Problems with mappings when changing the type of source table field?
Hello world
one question.
Is it a problem when I change my types of fields in my table of source of char for example varchar2 with mapping that uses this table?
In the mapping of the source table field Types are defined as Char fields. Do I have to change all the fields of char to varchar2 (via Import again from the source table and synchronize in the map)?
Thanks in advance.
GreetingsHello
If your new data type (in the database is compatible and big enough) then you probably don't have to change the class in your other mapping wise you need.
It a good practice to import the last definition of table (metadata) in the repository of OWB and then synchronize incoming.
Thank you
Fati -
Hello
I am mysql, PHP and DW
I have a table called "persons" in three columns, id, first_name and last_name.
I need to run a sql sentence where to get the id field as it is and the 2 other fields combined together as fullname.
I tried this as a recordset in DW5, but I received an error message:
Select people.id, people.first_name & "" & people.last_name as the display name
people,
Thanks for help
Joe
SELECT id, CONCAT(first_name, ' ', last_name) As fullname FROM people
The correct term is CONCATENATE, not combine. This is probably why you found nothing through research.
-
Hello
manuals strongly cautioned against the use of complex views in the repository instead of tables - is there a good reason for that - I know it will be higher when you ETL at the tables, but in terms of areas that do not warrant this type of development is all best practices with links between complex views - as I am too often short in errors in the repository when I try.
Thank you
Robert.If you want to use the views (when there is no other way) then the best practice is to use materialized views. It behaves as a concrete table and will not refresh as views are whenever you call display.
-
Download content clob of function instead of a blob column in a table
I found a few examples of how to create a download link data stored in a blob column. However my data are not stored in a blob column, but are created in a function that returns a clob. Of course, this feature can be used to fill a blob column, which can then be downloaded but there may be a more direct route.Hello René,.
I adapted one of my snippets for the download links for your case. The procedure is much the same as that concerning an existing blob. In order to offer the download, you must convert your clob in a blob, which can be done easily by using the corresponding function provided by the [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm url] DBMS_LOB-API.
The result might look like the following (untested) code snippet:CREATE OR REPLACE procedure download_from_function (p_func_argument IN VARCHAR2, p_filename IN VARCHAR2) AS l_http_response UTL_HTTP.resp; l_blob BLOB; l_raw RAW(32767); l_length INTEGER; l_dest_offset INTEGER := 1; l_src_offset INTEGER := 1; l_lang_context INTGER := DBMS_LOB.DEFAULT_LANG_CTX; l_warning INTEGER; BEGIN -- Initialize the BLOB. DBMS_LOB.createtemporary(l_blob, FALSE); -- replace the function call for src_clob DBMS_LOB.convertToBlob( dest_lob => l_blob, src_clob => your_clob_function(p_func_argument), amount => DBMS_LOB.LOBMAXSIZE, dest_offset => l_dest_offset, src_offset => l_src_offset, blob_csid => DBMS_LOB.DEFAULT_CSID, lang_context => l_lang_context, warning => l_warning); l_length := DBMS_LOB.getlength(l_blob); -- create response header OWA_UTIL.mime_header('text/plain', false); -- add furhter header attributes htp.p('Content-length: ' || l_length); htp.p('Content-Disposition: attachment; filename="' || p_filename || '"'); -- close the headers OWA_UTIL.http_header_close; -- download the BLOB WPG_DOCLOAD.download_file( l_blob ); -- release BLOB from memory DBMS_LOB.freetemporary(l_blob); EXCEPTION WHEN OTHERS THEN DBMS_LOB.freetemporary(l_blob); RAISE; END download_from_function; / -- Page process before header on blank page BEGIN download_from_function (p_func_argument => 'your_argument_for_your_clob_returning_function', p_filename => 'filename_for_download.txt'); END;
You must change the function name and arguments to fit your clob function signature. You can also add a characterset conversion if necessary. See the [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm] API - doc for more details.
-Udo
-
ORDSYS.ordimage resizes all blob of a table fields
I have a table with two blob fields that store the image jpg files.
-Original blob field: img_simbolo_op
-With resized image blob field: img_simbolo_thumb
This script allows me to resize img_simbolo_op blob field and store the image resized in img_simbolo_thumb area.
However, after the script is run, the two fields blob has been resized. Why?
CREATE OR REPLACE PROCEDURE ORGPOLV2.sp_resize_img(i_cod_op IN INTEGER) IS b BLOB; b1 blob; obj ORDSYS.ORDImage; BEGIN SELECT img_simbolo_op INTO b FROM tbl_op WHERE cod_op = i_cod_op FOR UPDATE; obj := ordsys.ordimage (ordsys.ordsource (b, NULL, NULL, NULL, SYSDATE, 1), NULL, NULL, NULL, NULL, NULL, NULL, NULL); obj.setProperties (); obj.process ('maxScale=32 32'); b1 := obj.getContent (); UPDATE tbl_op SET img_simbolo_thumb = b1 WHERE cod_op = i_cod_op; COMMIT; END sp_resize_img;
ORDImage.process () is the treatment the current LOB... which is a pointer to the LOB in IMG_SIMBOLO_OP.
IE - you update the LOB without an UPDATE command.
It's strange. I know.
You want to use instead ProcessCopy()... or another method that does the same thing.
The method has been discussed in various forums (e.g. APEX).
If you use ProcessCopy() make sure you give him an initialized LOB (for example dbms_lob.create_temporary ())
MK
-
Download the content of the BLOB from a custom table
In our application hosted the apex, the following code from the Express on the Application Developer's Guide works great to allow a user to download the contents of the blob of one of our paintings customized via a download button. However, the code does not work on the Cloud Oracle because the 'owa_util' package is no longer available. The code is as follows:
CREATE OR REPLACE PROCEDURE download_my_file (p_file in number) AS
v_mime VARCHAR2 (48);
V_LENGTH NUMBER;
v_file_name VARCHAR2 (2000);
Lob_loc BLOB;
BEGIN
Name of SELECT MIME_TYPE, BLOB_CONTENT, DBMS_LOB. GETLENGTH (blob_content)
IN lob_loc, v_file_name, v_mime, v_length
OF file_subjects
WHERE id = p_file;
--
-set up the HTTP header
--
-Use a NVL around the mime type and
-If it is null it the value application/octect
-application/octect can initiate a download of windows window
owa_util.mime_header (nvl(v_mime,'application/octet'), FALSE);
-set the size so that the browser knows how to download
HTP.p ("Content-length: ' |") v_length);
-the name of the file will be used by the browser if users only one save as
HTP.p ('Content-Disposition: attachment; filename = "" | ") Replace (Replace (substr (v_file_name, InStr(v_file_name,'/') + 1), Chr (10), null), Chr (13), null). '"');
-close the headers
owa_util.http_header_close;
-Download the BLOB
wpg_docload.download_file (Lob_loc);
end download_my_file;
/
In addition to the use of web services, does anyone know how to do this? Is it possible to add access to the package 'owa_util' in the cloud? I also tried apex_util.get_blob_file_src but that is also not available in the Oracle cloud.
Thank you
SteveHi Steve,.
(1) sys.owa_util is certainly available. You should be able to issue this block very well SQL commands:
Start
owa_util.print_cgi_env;
end;((2) I think the problem is that you have created a procedure that a) cannot not be granted run to the PUBLIC and b) cannot be called directly from the URL (because of a properly locked APEX listener which restricts entry points, i.e..) What procedures can be called directly from the URL).
Even if there was no prohibition of granting something to the PUBLIC, you would never get by the restriction on the call of your own point of entry of the URL. Also in a facility non - Cloud APEX (and even when you're using mod_plsql), the list of entry points is applied through the PlsqlRequestValidationFunction (http://docs.oracle.com/cd/E23943_01/web.1111/e10144/under_mods.htm#HSADM698).
Two ways around this:
(1) you can define a request of the process which, when called, downloads the requested file
or
(2) you may want to expose this functionality via a RESTful Service of media resources, even though right now, I'm not necessarily details how you would ensure access to it.
I hope this helps.
Joel
-
DELETE or empty field containing the BLOB in the roacle table
Hi all.
I have a table in the schema with a BLOB field. I store the photo of the employee in this area. Fields of this table are emp_name emp_id (number) (varchar2) and emp_photo (BLOB). I would like to ask if there is a way in pl / sql I could empty this field to null BLOB or reset this field so that the user can modify the saved photo graph and record another.
I'm looking for is something like
Thanks in advance.alter table employee set emp_photo = empty_blob() or alter table employee set emp_photo = null
>
I'm looking for
>
Looking in the documentation for Oracle? For example, in the EMPTY_BLOB, EMPTY_CLOB of the SQL language reference section?
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/functions049.htm
>
Goal
EMPTY_BLOB and EMPTY_CLOB return an empty LOB Locator that can be used to initialize an LOB variable or in an INSERT or UPDATE statement to initialize a LOB column or attribute EMPTY. EMPTY means that the LOB is initialized, but not filled with data.
. . .
ExamplesThe following example initializes the ad_photo of the sample pm.print_media EMPTY table column:
UPDATE print_media SET ad_photo = EMPTY_BLOB();
Maybe you are looking for
-
Difficulty to remove the history of web search on hp paviliontx1219usnotebook pc
Ireceived email on how to delete the history of web search. IF I WROTE IT DOWN CORRECTLY, IT WAS; CLICK START, TYPE FOLDER AND THEN ENTER, DOUBLE-CLICK THE TEMP FOLDER TO OPEN, CLICK CONTROL TO HIGHLIGHT, PRESS DELETE ON THE KEYBOARD, SO PROPTED TRY
-
a record of a layer in computer science.
How can I enter a layer records into my computer via the microphone port? I have the audio cable I don't know what program I should use or how. Help!
-
(Redirected) Work at home computer
I am interested in the Dell Inspiron 13 7000 Series, Windows Pro 8.1 7348I nspiron (64-bit) English with a common access card from Dell drive. I want to buy two monitors and wonder if I need to buy an additional video card to support two monitors.
-
Red of containment:-only cisco 7920 seems to be contained.
I'm running a WLC on a series of 2800 NM with version 5.0 and a LWAPP AP 1131. I have a Netgear access point within range of my Cisco AP 1131. When I turn on red for this NetGear access point containment, it seems to work, but ONLY a phone Cisco 7921
-
need site to display in mobile mode on hi res screen mobile
Hello.I created a few Web sites for mobile phones using Bootstrap 2 and 3.Now, I tried these on standard mobiles and they work fine.However I bought a windows phone and sites that I created are in the size of the office, because the pixels on my phon