Blob trigger
I was wondering what people do when they need to create a trigger on a blob column. I need to create a trigger to show on when a record was inserted and when it was updated. The only problem is that with a blob a insert is done first and then a updated to input the blob data. So i was wondering how people handled this situation.
Seems very difficult according to
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:487421613802.
Maybe you can create a mandatory PL/SQL procedure to be called that will do the work ?
Similar Messages
-
Trigger to blob column in Oracle - Need Help
Hi,
I need any help on Oracle Trigger
I have two table
- BIODATA_TABLE
- ADM_GALERY_PICTURE
All two table contain column SPIC_PICTURE2 that is blob column.
If the picture column update in table BIODATA_TABLE, i want it to update also in ADM_GALERY_PICTURE,
I have created the trigger to BIODATA_TABLE.
When i try to update the picture, the picture on the ADM_GALERY_PICTURE does not updated.
Below is my trigger, Please help me to correct it
CREATE OR REPLACE TRIGGER TRANSFER_PICTURE_TRIGGER
AFTER INSERT OR UPDATE
ON BIODATA_TABLE
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;
IF UPDATING
THEN
UPDATE ADM_GALERY_PICTURE
SET SPIC_PICTURE2 = :NEW.SPIC_PICTURE2
WHERE ADM_GALERY_PICTURE.SPIC_BIODATA_ID = :NEW.SPIC_BIODATA_ID;
END IF;
EXCEPTION
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END TRANSFER_PICTURE_TRIGGER;
thanksuser450549 wrote:
Hi,
I need any help on Oracle Trigger
I have two table
- BIODATA_TABLE
- ADM_GALERY_PICTURE
All two table contain column SPIC_PICTURE2 that is blob column.
If the picture column update in table BIODATA_TABLE, i want it to update also in ADM_GALERY_PICTURE,
I have created the trigger to BIODATA_TABLE.
When i try to update the picture, the picture on the ADM_GALERY_PICTURE does not updated.
Below is my trigger, Please help me to correct it
CREATE OR REPLACE TRIGGER TRANSFER_PICTURE_TRIGGER
AFTER INSERT OR UPDATE
ON BIODATA_TABLE
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;
IF UPDATING
THEN
UPDATE ADM_GALERY_PICTURE
SET SPIC_PICTURE2 = :NEW.SPIC_PICTURE2
WHERE ADM_GALERY_PICTURE.SPIC_BIODATA_ID = :NEW.SPIC_BIODATA_ID;
END IF;
EXCEPTION
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END TRANSFER_PICTURE_TRIGGER;
thankswithout your tables & without your data we can't run or test your code.
the picture on the ADM_GALERY_PICTURE does not updated.OK, I believe you, but what EXACTLY does occur? -
Problem building a trigger using a BLOB field in Oracle 10
My case is the following,
I'm trying to implement an AFTER trigger which uses the :new.blob_field to insert the new value in a table. Because of the documented AFTER restriction and :new use for blob fields, I've though to add other BEFORE trigger that calls a procedure in which I can store the :new value and later insert the temporary value in the table when the AFTER trigger is executed.
The Idea is the following:
BEFORE trigger :new -> TEMP
and then
AFTER trigger uses TEMP to store in the new table
So, the final questions are the following:
-Any other idea to do the same, that is, to use the ":new" value in an AFTER trigger?
-How can I do this with the temp variable, is this correct?:
PROCEDURE store_blob ( new_val BLOB ) IS
BEGIN
DBMS_LOB.CREATETEMPORARY(new_blob_temp,TRUE, DBMS_LOB.SESSION);
-- fill with data
DBMS_LOB.COPY (new_blob_temp,new_val,DBMS_LOB.GETLENGTH(new_val),1,1);
END store_blob ;
Because of the design of the application I have to use the AFTER trigger to store the new value so I must find a solution for this type of fields.
Sorry for the size of the text and also for my english.
Thanks in advanceSQL> create or replace trigger trg1 after insert on test_blob for each row
2 begin
3 insert into test_blob2 values (:new.a);
4 end;
5 /
Trigger created.
SQL> insert into test_blob values ('123456789');
1 row created.
SQL> desc test_blob;
Name Null? Type
A BLOB
SQL> desc test_blob2
Name Null? Type
A BLOB
SQL>
SQL> select dbms_lob.getlength(a) from test_blob2;
DBMS_LOB.GETLENGTH(A)
5 -
How to compare Blob datatype in a Trigger?
Let's say I've the following trigger to log changes of "Document", which is in Blob type:
create or replace TRIGGER audit_file AFTER INSERT OR UPDATE OR DELETE ON MyFileTable FOR EACH ROW
BEGIN
BEGIN
IF updating('Document') AND(:OLD.Document != :NEW.Document) THEN
Log_This ('Document', :OLD.Document, :NEW.Document);
END IF;
end;
end;
Can ":OLD.Document != :NEW.Document" actually compare the content of those two docs, or do they just compare their locators/pointes? If yes, is there a built-in function I can use to do comparison of their actual content?For BLOBs you can use
<p/>
FUNCTION DBMS_LOB.compare(lob_1 IN BLOB,
lob_2 IN BLOB,
amount IN INTEGER := 4294967295,
offset_1 IN INTEGER := 1,
offset_2 IN INTEGER := 1)
RETURN INTEGER; -
Converter via trigger from blob to ordimage
Hi i make trigger for convertion blob to ordimage but when i execute it i got errors what should i do to fix this ?
create or replace
TRIGGER obrazy.dodanie_id23233
AFTER INSERT OR UPDATE ON fotki
FOR EACH ROW
BEGIN
INSERT INTO FOTKIORD (FOTKAID1, FOTKA1)
VALUES (:NEW.fotkaid, ORDSYS.SI_STILLIMAGE(:NEW.fotka));
END;
Warning: oci_execute(): ORA-29400: data cartridge error IMG-00701: unable to set the properties of an empty image ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 75 ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 65 ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 29 ORA-06512: at "ORDSYS.ORDIMG_PKG", line 33 ORA-06512: at "ORDSYS.ORDIMAGE", line 945 ORA-06512: at "ORDSYS.SI_STILLIMAGE", line 58 ORA-06512: at "OBRAZY.DODANIE_ID23233", line 2 ORA-04088: error during execution of trigger 'OBRAZY.DODANIE_ID23233' in C:\Program Files (x86)\Zend\Apache2\htdocs\upload.php on line 45994229 wrote:
I created trigger and it works fine but for si_stillimag i cant why ???? Works fine for me:
SQL> select *
2 from v$version
3 /
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> create table fotki(
2 fotkaid number not null,
3 fotka blob,
4 constraint fotki_pk primary key(fotkaid)
5 )
6 /
Table created.
SQL> create table fotkiord(
2 fotkaid1 number not null,
3 fotka ordsys.si_stillimage
4 )
5 segment creation immediate
6 /
Table created.
SQL> create or replace
2 trigger fotki_aiur
3 after insert
4 or update
5 on fotki
6 for each row
7 begin
8 insert
9 into fotkiord
10 values(
11 :new.fotkaid,
12 case
13 when :new.fotka is null then null
14 when dbms_lob.compare(:new.fotka,empty_blob()) = 0 then null
15 else ordsys.si_stillimage(:new.fotka)
16 end
17 );
18 end;
19 /
Trigger created.
SQL> -- NULL fotka
SQL> insert
2 into fotki
3 values(
4 1,
5 null
6 )
7 /
1 row created.
SQL> -- empty_blob() fotka
SQL> insert
2 into fotki
3 values(
4 2,
5 null
6 )
7 /
1 row created.
SQL> -- actual image fotka
SQL> DECLARE
2 v_blob blob;
3 v_bfile BFILE := BFILENAME('TEMP','HONDA CR-V.jpg');
4 BEGIN
5 DBMS_LOB.CREATETEMPORARY(v_blob,TRUE);
6 DBMS_LOB.fileopen(v_bfile,DBMS_LOB.file_readonly);
7 DBMS_LOB.LOADFROMFILE(v_blob,v_bfile,DBMS_LOB.GETLENGTH(v_bfile));
8 DBMS_LOB.FILECLOSE(v_bfile);
9 INSERT
10 INTO FOTKI
11 VALUES(3,v_blob);
12 DBMS_LOB.FREETEMPORARY(v_blob);
13 END;
14 /
PL/SQL procedure successfully completed.
SQL> select *
2 from fotki
3 /
FOTKAID
FOTKA
1
2
3
FFD8FFE000104A46494600010101006000600000FFDB004300020101020101020202020202020203
0503030303030604040305070607070706070708090B0908080A0807070A0D0A0A0B0C0C0C0C0709
FOTKAID
FOTKA
SQL> select *
2 from fotkiord
3 /
FOTKAID1
FOTKA(CONTENT_SI(LOCALDATA, SRCTYPE, SRCLOCATION, SRCNAME, UPDATETIME, LOCAL), C
1
2
3
SI_STILLIMAGE(ORDSOURCE('FFD8FFE000104A46494600010101006000600000FFDB00430002010
10201010202020202020202030503030303030604040305070607070706070708090B0908080A080
FOTKAID1
FOTKA(CONTENT_SI(LOCALDATA, SRCTYPE, SRCLOCATION, SRCNAME, UPDATETIME, LOCAL), C
7070A0D0A0A0B0C0C0C0C0709', NULL, NULL, NULL, '05-MAY-13', 1), 126992, 'JFIF', 6
48, 1152, 'image/jpeg', '24BITRGB', 'JPEG', NULL, NULL, NULL, NULL, NULL, NULL)
SQL>SY. -
Display data from BLOB column.
Hi All,
I want to display data from blob datatype field, which contains HTML and GIF both files.
If I set it's property from file format IMAGE then i get data only gif.
if anybody have answer plz revert back...
awaiting...
JunedHi Juned
What I suggest is that you may have overlapping fields. One to show HTML and other to show GIF. You need to add one more column to your table in order identify if the BLOB is GIF or HTML.
In the Format Trigger of each of these two fields, inspect the value of flag column and hide one field if the datatype is not its type.
For instance, if flag field is 0 then hide Image field and show HTML field. If flag field is 1 then show Image field and hide HTML field.
Regards
Sripathy -
IR Report found 1 million record with blob files performance is too slow!
we are using
oracle apex 4.2.x
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
mod_plsql with Apache
Hardware: HP proliant ML350P
OS: WINDOWS 2008 R2
customized content management system developed in apex.when open the IR report have 1 ml rows found and each rows have blob(<5MB as pdf/tiff/bmp/jpg) it will be raising rows in future! but the searching performance is very slow!
how can increasing the performance?
how can showing progressing status to user while searching progress going on IR report itself?
Thanx,
RamIt's impossible to make definitive recommendations on performance improvement based on the limited information provided (in particular the absence of APEX debug traces and SQL execution plans), and lacking knowledge of the application requirements and access to real data.
As noted above, this is mainly a matter of data model and application design rather than a problem with APEX.
Based on what has been made available on apex.oracle.com, taking action on the following points may improve performance.
I have concerns about the data model. The multiple DMS_TOPMGT_MASTER.NWM_DOC_LVL_0x_COD_NUM columns are indications of incomplete normalization, and the use of the DMS_TOPMGT_DETAILS table hints at an EAV model. Look at normalizing the model so that the WM_DOC_LVL_0x_COD_NUM relationship data can be retrieved using a single join rather than multiple scalar subqueries. Store 1:1 document attributes as column values in DMS_TOPMGT_MASTER rather than rows in DMS_TOPMGT_DETAILS.
There are no statistics on any of the application tables. Make sure statistics are gathered and kept up to date to enable the optimizer to determine correct execution plans.
There are no indexes on any of the FK columns or search columns. Create indexes on FK columns to improve join performance, and on searched columns to improve search performance.
More than 50% of the columns in the report query are hidden and not apparently used anywhere in the report. Why is this? A number of these columns are retrieved using scalar subqueries, which will adversely impact performance in a query processing 1 million+ rows. Remove any unnecessary columns from the report query.
A number of functions are applied to columns in the report query. These will incur processing time for the functions themselves and context switching overhead in the case of the non-kernel dbms_lob.get_length calls. Remove these function calls from the query and replace them with alternative processing that will not impact query performance, particularly the use of APEX column attributes that will only apply transformations to values that are actually displayed, rather than to all rows processed in the query.
Remove to_char calls from date columns and format them using date format masks in column attributes.
Remove decode/case switches. Replace this logic using Display as Text (based on LOV, escape special characters) display types based on appropriate LOVs.
Remove the dbms_lob.get_length calls. Instead add a file length column to the table, compute the file size when files are added/modified using your application or a trigger, and use this as the BLOB column in the query.
Searching using the Search Field text box in the APEX interactive report Search Bar generates query like:
select
from
(select
from
(...your report query...)
) r
where ((instr(upper("NWM_DOC_REF_NO"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("NWM_DOC_DESC"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("SECTION_NAME"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("CODE_TYPE"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("REF_NUMBER_INDEX"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("DATE_INDEX"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("SUBJECT_INDEX"), upper(:apxws_search_string_1)) > 0
or instr(upper("NWM_DOC_SERIEL"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("NWM_DOC_DESCRIPTION"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("NWM_DOC_STATUS"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("MIME_TYPE"), upper(:APXWS_SEARCH_STRING_1)) > 0
or instr(upper("NWM_DOC_FILE_BINARY"), upper(:APXWS_SEARCH_STRING_1)) > 0 ))
) r
where
rownum <= to_number(:APXWS_MAX_ROW_CNT)
This will clearly never make use of any available indexes on your table. If you only want users to be able to search using values from 3 columns then remove the Search Field from the Search Bar and only allow users to create explicit filters on those columns. It may then be possible for the optimizer to push the resulting simple predicates down into the inlined report query to make use of indexes on the searched column.
I have created a copy of your search page on page 33 of your app and created an After Regions page process that will create Debug entries containing the complete IR query and bind variables used so they can be extracted for easier performance analysis and tuning outside of APEX. You can copy this to your local app and modify the page and region ID parameters as required. -
How can I open different binary files from BLOB column ?
If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
PROCEDURE getblob
(P_FILE IN VARCHAR2
IS
vblob blob;
vmime_type myblobs.mime_type%type;
length number;
begin
select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
length := dbms_lob.getlength(vblob);
if length = 0 or vblob is null then
htp.p('Document not available yet.');
else
owa_util.mime_header(vmime_type);
htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
owa_util.http_header_close;
wpg_docload.download_file(vblob);
end if;
exception
when others then
htp.p(sqlerrm);
END;
Create a DAD on your application server (refer to documentation on how to create a DAD).
Display the blob from forms (e.g. on a when-button-pressed trigger):
web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
For storing blobs in a directory on your db server take a look at the dbms_lob package.
For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
HTH
Gerald Krieger -
Getting error while creating trigger!!
Hi Guys,
I am getting the following error while creating trigger in Oracle10g Database in TOAD environment.
Error: PLS-00306: wrong number or types of arguments in call to '='
Table details:
One of the column having BLOB Data type in the table.
In the trigger, I have compared :old and :new values.
CREATE OR REPLACE TRIGGER INPL.trigger_new
AFTER INSERT OR UPDATE OR DELETE
ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
action_flag VARCHAR2(1);
new_image BLOB;
BEGIN
IF UPDATING
THEN
action_flag := 'U';
ELSIF DELETING
THEN
action_flag := 'D';
ELSIF INSERTING
THEN
action_flag := 'I';
END IF;
IF (:NEW.image = :OLD.image)
THEN
new_image := '';
ELSE
new_image := :NEW.image;
END IF;
INSERT INTO TABLE_NEW(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
end;
Any one knows about this issue, please let me know with the proper solution.
Thanks for your immediate response!
Regards,
LakshmanCREATE OR REPLACE TRIGGER INPL.trigger_new
AFTER INSERT OR UPDATE OR DELETE
ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
action_flag VARCHAR2(1);
new_image BLOB;
BEGIN
IF UPDATING
THEN
action_flag := 'U';
ELSIF DELETING
THEN
action_flag := 'D';
ELSIF INSERTING
THEN
action_flag := 'I';
END IF;
IF (:NEW.image = :OLD.image)
THEN
new_image := '';
ELSE
new_image := :NEW.image;
END IF;
INSERT INTO TABLE_AUD(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
end;
I am getting the error in line at If condition
Error: PLS-00306: Wrong number or tpyes of arguments in call '='
Please let me know if any one knows exact solution!
Thanks in advance!
Regards,
Lakshman -
Import of .bacpac fails on view with instead of delete trigger
I'm using Azure Premium SQL.
When I export the database using the portal and blob storage and then immediately try to import it as a test to a new database (also using the portal) I get the error below.
Looking at the restored database, many of the views are not there (including the one listed) although that may be because it failed on this view during the restore.
The trigger seems to be working just fine in the original database. It just won't restore from the bacpac.
BTW, I notice in the original database before backup, the trigger says "DELETE
FROM alndata.AptChangeLog", not "DELETE alndata.AptChangeLog"
Thanks.
Bryan
Error encountered during the service operation.
Could not import package.
Error SQL72014: .Net SqlClient Data Provider: Msg 8197, Level 16, State 4, Procedure AdminChangeLogAptNameDelete, Line 7 The object 'AlnData.AdminChangeLogAptName' does not exist or is invalid for this operation.
Error SQL72045: Script execution error. The executed script:
CREATE TRIGGER [AlnData].[AdminChangeLogAptNameDelete]
ON [AlnData].[AdminChangeLogAptName]
INSTEAD OF DELETE
AS BEGIN
SET NOCOUNT ON;
DELETE alndata.AptChangeLog
WHERE aptchangelog_id IN (SELECT aptchangelog_id FROM deleted);
ENDHello,
Sorry for delay.
I had found a feedback about trigger issue when restore SQL Database from a BACPAC file. Microsoft said the fixed will be available in the next major release of DacFx.
Feedback:
SQL Azure fires a trigger when restoring from bacpac
You can refer to the workarounds in the feedback. For example, if there is small amount of triggers on the database, you can try to remove the triggers and then recreate when restore from bacpac file.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to Strore A Video or an Audio File in the BLOB
Hi Friends,
My Name is Rahul.I am looking for a solution of how to store a Data of more 64KB using Data Type Long Raw,BLOB,CLOB using JDBC Concepts and without using a Trigger or a stored procedure.
If at all some one can help me with a written code it would be of a great help to me.
Regards,
RAHULhai,
This two programs are working properly incase of IMAGES
BUT I WANT TO STORE RESUMES LIKE ALL ARE IN ".DOC" FORMAT
WHAT IS THE SOLUTION TO THIS .CURRENTLY IT IS NOT WORKING IN CASE OF .DOC FILES
CAN ANY BODY HELP ME PLESE.
Thanks in advance
//to store photo
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
class PhotoInsert
public static void main(String args[])throws Exception
//Class.forName("OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con;
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora","scott","tiger");
// System.out.println(con);
PreparedStatement ps=con.prepareStatement("insert into empall2 values(?,?,?,?)");
System.out.println("Vehical to take Sql Statements Created..");
ps.setInt(1,101);
ps.setString(2,"Rama");
ps.setFloat(3,5000);
File photo=new File("c:\\chinna\\kona\\Chinababu_Konagif");
FileInputStream photoStream=new FileInputStream(photo);
ps.setBinaryStream(4,photoStream,(int)photo.length());
ps.executeUpdate();
System.out.println("Record Inserted..");
photoStream.close();
con.close();
//to receive
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
class PhotoRetrieve
public static void main(String args[])throws Exception
//Class.forName("OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con;
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora","scott","tiger");
Statement st=con.createStatement();
System.out.println("Vehical to take SQL Statementscreated");
ResultSet rs=st.executeQuery("select *from empall1");
rs.next();
InputStream in=rs.getBinaryStream("ephoto");
FileOutputStream fout=new FileOutputStream("abc.gif");
int byteRead=0;
byte[] buffer=new byte[4096];
while((byteRead=in.read(buffer))!=-1)
fout.write(buffer,0,byteRead);
System.out.println("photo stored into new file");
fout.close();
in.close();
st.close();
con.close();
//TAble structure is
sql>create table empall(eno number(4),ename varchar2(12),esalary number(9),ephoto blob);
That two programs are working properly incase of IMAGES
BUT I WANT TO STORE RESUMES LIKE ALL ARE IN ".DOC" FORMAT
WHAT IS THE SOLUTION TO THIS .CURRENTLY IT IS NOT WORKING IN CASE OF .DOC FILES
CAN ANY BODY HELP ME PLESE.
Thanks in advance
Kanachanaa -
Inserting Image into a BLOB column in Oracle9i
Hi,
I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
Same thing is true for CLOB in 9i.
Would you please try with this code?
TABLE
Create table x
(Id number,
Name CLOB,
Pict BLOB);
WHEN-BUTTON-PRESSED trigge
declare
x varchar2(265);
begin
x := get_file_name;
read_image_file (x, 'GIF', 'picture.pict');
end;
Take care,
TarekForms 9i and Oracle 9i work fine together for this case.
-
Hi all,
I need to Open a file which is stored in the Data base Table & the Data type is of BLOB so i am populating the data but i need to display the attachment which is stored in the BLOB file when the button is clicked & i am using Oracle 10g
I have been just placed a Button & written the below code in WHEN_BUTTON_PRESSED Trigger & i have tried it out by placing a image icon & WHEN_IMAGE_PRESSED but it's not getting worked
It is Directly Coming in to Exception..
DECLARE
vblob BLOB;
vmime VARCHAR2(30);
BEGIN
select attachment,MIME_TYPE into vblob,vmime
from Table_name_a
where UNIQUE_ID = 16842;--:ITEM_RESULT.DRAWINGNO;
htp.init;
owa_util.mime_header( vmime, false);
-- owa_util.mime_header( 'image/jpeg', false);
-- owa_util.mime_header( 'image/jfif', false);
-- owa_util.mime_header( 'image/gif', false);
-- owa_util.mime_header( 'application/word' , FALSE);-- to read MS WORD doc
owa_util.mime_header( 'application/pdf' , FALSE);-- to read ADObE
message ('attachment type is' ||vmime);
message ('attachment type is' ||vmime);
owa_util.http_header_close;
wpg_docload.download_file(vblob);
exception
when no_data_found then
dbms_output.put_line('1. attachment type is' ||vmime);
-- NULL;
end;
so if any body has any idea Please let me Know
Hope for the Reply.
Thanks & Regards
K Nikethan ReddyHi,
Thanks for the reply,
The Document which u Refer is Showing how to Retrieve the Files from the Local System (i.e by giving the path) but i need to populate it from the database.
K Nikethan Reddy. -
Link to file (blob) with 2 primary keys
I am experiencing a problem in APEX 3.1.2 with viewing files uploaded through a simple form based on a table. If that table has a single column primary key, the link works perfectly. If the table has a two column primary key, the link throws a "pls/apex/apex_util.get_blob_file not found on server". I made a simple test case and if I change the table to use a 1 column PK, (and change the process on the APEX form to match), the link works. When I change the PK back to 2 columns (and the APEX processes), the link stops working on the same record. Is this a known issue? I couldn't find anything useful in Metalink or these forums.
I may be missing something obvious, but could someone repeat this test case and let me know if you encounter the same thing?
1) Create table called test_blob with columns
id1 number
id2 number
file_blob blob
filename varchar2
mimetype varchar2
update_date date
and a primary key of id1 only
2) Create an APEX form based on that table and configure the file browse item source with the mimetype fields, filename field, .... (You'll need to unhide the id1 field unless you bothered creating a trigger,etc to populate it)
3) Upload the document, PDF, ... of your choice
4) Go back to the form on that record and click the download link. It should work to open the file
5) Change the primary key on the table to use id1 and id2 and change the processes on the APEX form to use the 2 column primary key
6) Repeat step 4, but now the link no longer works. If you toggle back to the 1 column PK, the link works again.
I worked around it by making a new column that concatenates id1 and id2 so I can move my application forward with a 1 column PK, but this is frustrating. BTW, I did try to use the get_blob_file_src API to work around the problem, but the link it generates is identical to that generated automatically so the same problem occurs.
Rgds/Mark M.It rather depends on what access you have and what the keys are, but for my table:
1) Drop existing primary key constraint
2) Add a new column called something like key_id
3) Change your trigger which currently sets your existing id to also set the new key_id by setting key_id := id1 || ' ' || id2;
4) Add new primary key constraint for new column
Note that to do these changes, you may need to empty the table.
Rgds/Mark M. -
Why wont BLOBS commit in forms
I used read-image-file in a 'When-image-pressed' trigger to insert the image. It did'nt work with message '47100 - Cant read image file ...'. I noticed other images in the example tables where all around 100k so i resized mine from 900k to 100k and tried again and it worked and committed but it still wouldnt return the image in a query. I then loaded the image through a procedure using DBMS_LOB and then queried the record in Forms and it worked. So
Why wouldnt the larger image work, i thought blobs were up to 4gb and
Why is Forms not commiting the image to the database
Anyone more answers or ideas?While you can use DML statements from triggers (and 6i obviously treats them more logically than 4.5), Forms is structured more towards making DML changes through blocks - that is, you type the new record into the block and when you save the form it gets written into the database as an insert.
Rather than writing to global variables and adding code to the first block's on-update, you could write the record you want insert to a hidden block based on the appropriate table, so that it fits within the "normal" forms DML structure.
I don't know whether these being committed is considered a bug, but bear in mind that Forms 4.5 as a product is getting VERY old. I haven't used it since some Oracle Apps 10.7 work something like seven years ago.
Maybe you are looking for
-
How can I save the all the values of a tree control ?
I have a problem, in run time, I adds new items on a tree control, but i don´t know how I can save the values of the child text of each item in a file. Thanks.
-
Hi, I have problem with accesing Assets - Fonts (Synced Typekit fonts)!
Hi, I have problem with accesing Assets -> Fonts (Synced Typekit fonts)! Can You help me with that problem?
-
How to configure DPM2012R2 to use a private cloud
Hi, I have configure a private cloud over several MS 2012 R2 servers. I have the storage and all required network done. I then installed DPM 2012 R2 and would like to use the "long term" storage function with the private cloud that I created. Has any
-
$ sudo pacman -Syu :: Synchronizing package databases... core is up to date extra is up to date community is up to date multilib is up to date :: Starting full system upgrade... :: Replace lib32-dbus with multilib/lib32-libdbus? [Y/n] y resolving dep
-
HT1688 how to unlok my iphone4 at&t
how to unlok my iphone at&t ime012421005512342 pliz