Blob filename
i've a table with a blob-column
i use webutil to save the object to the client.
but how can i get the original filename of the object? a.e the name of the presentation (when it was uploaded) stored in the db (document.ppt).
another question is: how can i give the user the possibility to choose between save and open the document which comes from the blob-column?
i specialy need the file-type: gif,ppt,jpg of the database object.
if i don't have this, it makes no sense to download the object and save it to the filesystem.
Similar Messages
-
Sql server bulk insert blob filename parameter
My problem SQL script:
declare @filepath varchar(100)
set @filepath = 'E:\foto\1.jpg'
INSERT INTO [dbo].[MsQuestions] ([TestCategoryID], [LevelID], [TestTypeID], [QuestionText], [QuestionImg])
select 1 , 1, 8, 'data gambar',BulkColumn FROM OPENROWSET(BULK @filepath , SINGLE_BLOB)
thanks.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%
string sConn = @"server=.; database=OnlineTesting; Integrated Security=True";
SqlConnection objConn = new SqlConnection(sConn);
objConn.Open();
string sTSQL = "exec sp_filenamea";
SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
objCmd.CommandType = CommandType.Text;
SqlDataReader dr = objCmd.ExecuteReader();
dr.Read();
Response.BinaryWrite((byte[])dr["QuestionImg"]);
objConn.Close();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Exec SP</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>Perhaps this
http://dimantdatabasesolutions.blogspot.co.il/2009/05/how-to-uploadmodify-more-than-one-blob.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
PDF's storing in Compressed BLOB Securefile doesn't save space
Hello 1 have a Test-table in 10G with 1 LOB-segment of 1700 Mb , 1743 records with PDF's
In 11G 11.1.0.7 i create a table with SCEUREFILE in ASSM tablespace, the table is partitioned.
When 1 insert the 1743 records wioth PDF's the total segmentsize is even 1900 MB...???
Why are my PDF's not more compressed?
CREATE TABLE SNL_SCAN.DOCUMENTEN_LGE
OWNER VARCHAR2(50 BYTE),
COMPANY VARCHAR2(50 BYTE),
SCAN_ID VARCHAR2(50 BYTE) NOT NULL,
DOCUMENT BLOB,
FILENAME VARCHAR2(255 BYTE),
CONTENT_TYPE VARCHAR2(50 BYTE),
ORDER_DATE DATE,
SCAN_DATE DATE,
STATUS VARCHAR2(1 BYTE),
CUSTOM_01 VARCHAR2(50 BYTE),
CUSTOM_02 VARCHAR2(50 BYTE),
CUSTOM_03 VARCHAR2(50 BYTE),
CUSTOM_04 VARCHAR2(50 BYTE),
CUSTOM_05 VARCHAR2(50 BYTE),
CUSTOM_06 VARCHAR2(50 BYTE),
OWNER_ID NUMBER(9) NOT NULL,
SCAN_PLACE_DATE DATE DEFAULT sysdate
TABLESPACE SCAN_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
PARTITION BY RANGE (SCAN_DATE)
INTERVAL( NUMTOYMINTERVAL(1,'MONTH'))
PARTITION DOCUMENTEN_LGE_200605 VALUES LESS THAN (TO_DATE(' 2006-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
COMPRESS FOR ALL OPERATIONS
TABLESPACE SCAN_DATA
LOB (DOCUMENT) STORE AS SECUREFILE
( TABLESPACE SCAN_DATA
ENABLE STORAGE IN ROW
CHUNK 8192
RETENTION
NOCACHE
COMPRESS HIGH
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
COMPRESS FOR ALL OPERATIONS
NOCACHE
NOPARALLEL
MONITORING
ENABLE ROW MOVEMENT;Hello Sushil,
i have used the securefileperformancepaper.pdf as test doument, i also simplefied the test:
1.
Inserted the pdf into a table:
declare
Dest_loc BLOB;
Src_loc BFILE;
BEGIN
INSERT INTO SNL_SCAN.DOCUMENTEN (scan_id,owner_id, document) VALUES (1,1, EMPTY_BLOB())
RETURNING document INTO Dest_loc;
Src_loc := BFILENAME ('DIR_TESTCASE', 'sec.pdf');
DBMS_LOB.FILEOPEN (Src_loc, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LOADFROMFILE (Dest_loc, Src_loc, dbms_lob.getlength (Src_loc));
DBMS_LOB.FILECLOSE (Src_loc);
INSERT INTO SNL_SCAN.DOCUMENTEN (scan_id,owner_id, document) VALUES (2,2, EMPTY_BLOB())
RETURNING document INTO Dest_loc;
Src_loc := BFILENAME ('DIR_TESTCASE', 'sec.pdf');
DBMS_LOB.FILEOPEN (Src_loc, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LOADFROMFILE (Dest_loc, Src_loc, dbms_lob.getlength (Src_loc));
DBMS_LOB.FILECLOSE (Src_loc);
END;
2.
created table
CREATE TABLE NOCOMP ( a BLOB)
LOB(a) STORE AS SECUREFILE
( CACHE ) ;
inserted 10 documents
10x-----
insert into nocomp
(select document from snl_scan.documenten where scan_id= '1');
commit;
the lobsegment is now 4,19 MB
3.
inserted another 100 rows
the lobsegment is now 42,2 MB
4.
Created table with compressed LOB
CREATE TABLE COMP ( a BLOB)
LOB(a) STORE AS SECUREFILE
( COMPRESS HIGH
CACHE ) ;
inserted 10 documents
10x-----
insert into comp
(select document from snl_scan.documenten where scan_id= '1');
commit;
the lobsegment is now 4,25 MB
inserted another 100 rows
the lobsegment is now 42,2 MB
5.
so there is no compression.
6.
Created table with compressed LOB an DEDUPLICTION
CREATE TABLE COMP_DEDUP ( a BLOB)
LOB(a) STORE AS SECUREFILE
( COMPRESS HIGH
DEDUPLICATE
CACHE ) ;
7,
inserted 10 documents
10x-----
insert into comp
(select document from snl_scan.documenten where scan_id= '1');
commit;
the lobsegment is now 1,25 MB
inserted another 100 rows
the lobsegment is now 1,25 MB
Deduplication is working, compression with the oracle pdf isn't saving any space......
8.
VIEW DBA_LOBS
TABLE_NAME COL SEGMENT_NAME CACHE LOGGING ENCRYPT COMPRESSION DEDUPLICATION IN_ROW FORMAT PARTITIONED SECUREFILE
COMP_DEDUP A SYS_LOB0000107972C00001$$ YES YES NO HIGH LOB YES N/A NO YES
COMP A SYS_LOB0000107981C00001$$ YES YES NO HIGH NO YES N/A NO YES
NOCOMP A SYS_LOB0000107984C00001$$ YES YES NO NO NO YES N/A NO YES
Hope this helps.
Rob Tousain
00 31 6 28660287 -
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. -
Cannot insert a picture (image - BLOB) directly into a report field?
Hello
I am new to APEX and I am trying to create a table with an image together with an input form and an output report but I am having difficulty in displaying the image in the report field.
My work so far:
1 I am using APEX to generate a table with a BLOB, Filename and Last_Update_Date fields.
2 I have followed the article on the http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm.
3 The title is: 'Defining and Viewing BLOB Data in Oracle Application Express 3.1'
4 I have generated the table, form and report.
5 I have downloaded the image as an attachment and inline on the form Ok.
6 I have successfully downloaded an image on the report with the words image as a link in the report field. Note the http path is: http://glkas0892v.greenlnk.net:7777/pls/htmldbDEV/apex_util.get_blob_file?a=475&s=7094501042405784&p=3&d=1360784770040764381&i=1360783771822764369&p_pk1=123&p_pk2=&p_ck=2F17C4FBDE22B25A02026F67AB59D4F0&p_content_disposition=inline
7 I have unsuccessfully tried to insert the image directly into a report field itself. The report displays the picture as a symbol with a cross.
Note the http path is: http://glkas0892v.greenlnk.net:7777/pls/htmldbDEV/apex_util.get_blob?s=7094501042405784&a=475&c=1360779972416764351&p=2&k1=&k2=&ck=4BFA878ADD2028D2E9B127BB03F78B8D&rt=CR
7a I have reduced the size of the images to 20 by 30 pixels but no joy.
Conclusion
The only difference I can see is that in 6 the command in the path is apex_util.get_blob_file? But in 7, unsuccessful, the command in the path is apex_util.get_blob?
Please help me as there must be some one out there who has experienced the same situation.
Thanks
BrianMy colleague has found the answer. A known fault exists within APEX 3.1 in that the Blob declaration must be after the Last update declaration and then the image displays correctly on the report.
-
How to read file to blob variable
I Write so:
fil BFILE;
lobd BLOB;
filename VARCHAR2(255);
filename:='1.doc';
fil:=BFILENAME('DOCS_IN',filename);
dbms_lob.CREATETEMPORARY(lobd,true);
dbms_lob.fileopen(fil, dbms_lob.lob_readonly);
dbms_lob.LOADFROMFILE( lobd,fil,dbms_lob.getlength(fil), 1, 1);
Ошибка:
ORA-22285: non-existent directory or file for GETLENGTH operation
But file was successfully open by dbms_lob.fileopen.create table temp
key INTEGER,
trash BLOB
create directory hdoc as '/tmp';
--For this example, /tmp is the directory and test.bin is the filename.
--You must ensure that a file exist at that location (/tmp/test.bin) for
--this sample to work. The file and location referenced should be that which
--is on the server.
DECLARE
lobd BLOB;
fils BFILE := BFILENAME('HDOC', 'test.bin');
amt INTEGER;
BEGIN
DBMS_LOB.FILEOPEN(fils, dbms_lob.file_readonly);
amt:=DBMS_LOB.getlength(fils);
insert into temp values (1, empty_blob()) returning trash into lobd;
DBMS_LOB.LOADFROMFILE(lobd, fils, amt);
COMMIT;
DBMS_LOB.FILECLOSE(fils);
END; -
So I follow the tutorial here:
http://img.photobucket.com/albums/v53/telegramsam17/epicfail.jpg
And I end up with this error:
http://img.photobucket.com/albums/v53/telegramsam17/epicfail2.jpg
I'm sure it's something boneheadedly obvious, but I'm not seeing it.
(And in my defense, I am not a database developer, I'm just developing a database because I'm a sucker who works for state government and pulled the booby prize on this one. I got my degree in Geology, kids, and this ain't rocks. ;-;)I can read what it says, I just don't know why it's doing that or how to make it stop doing it, hence I asked for help. I set it up identically to the tutorial (which I just took a screencap of the section I was referring to because page itself is lengthy. The whole page is here: http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm).
This is the table I'm pulling from:
CREATE TABLE "INDIV_PHOTO"
( "INDIV_PHOTO_ROW_ID" NUMBER NOT NULL ENABLE,
"CONTACT_ID" NUMBER NOT NULL ENABLE,
"PHOTO" BLOB,
"FILENAME" VARCHAR2(255),
"MIMETYPE" VARCHAR2(255),
"LAST_UPDATE_DATE" DATE,
CONSTRAINT "INDIV_PHOTO_PK" PRIMARY KEY ("INDIV_PHOTO_ROW_ID") ENABLE
ALTER TABLE "INDIV_PHOTO" ADD CONSTRAINT "INDIV_PHOTO_FK1" FOREIGN KEY ("CONTACT_ID")
REFERENCES "BGCORE"."TBL_CONTACTS" ("CONTACT_ID") ENABLE
CREATE OR REPLACE TRIGGER "BI_INDIV_PHOTO"
before insert on "INDIV_PHOTO"
for each row
begin
if :NEW."INDIV_PHOTO_ROW_ID" is null then
select "INDIV_PHOTO_SEQ".nextval into :NEW."INDIV_PHOTO_ROW_ID" from dual;
end if;
end;
ALTER TRIGGER "BI_INDIV_PHOTO" ENABLE
/ -
Workaround for function to_blob in Oracle 8i
Hi all,
this query run in Oracle 9i but not in oracle 8i:
select
to_lob(dbms_lob.substr(data,dbms_lob.getlength(data)-dbms_lob.instr(data,'3F3E')-1,dbms_lob.instr(data,'3F3E')+4)) as stream_data,
filename as stream_name,
substr(filename,instr(filename,'.')+1,length(filename)) as stream_type,
dbms_lob.getlength(to_lob(dbms_lob.substr(data,dbms_lob.getlength(data)-dbms_lob.instr(data,'3F3E')-1,dbms_lob.instr(data,'3F3E')+2))) as content_length,
progr as stream_progr
from
vm_mmsrelay_mmcontent
where id_msg like '%1071760263441%'
and CONTENTTYPE='application/smil'
SQL> desc vm_mmsrelay_mmcontent
Name Null? Type
DATA BLOB
FILENAME VARCHAR2(50)
CONTENTTYPE VARCHAR2(50)
ID_MSG NOT NULL VARCHAR2(150)
PROGR NOT NULL NUMBER(38)
Thanks in advanceHave you already configured a Heterogeneous Services and Generic Connectivity to create a database link from Oracle to SQL Server? I haven't tried copying IMAGE data from SQL Server via Heterogeous Services myself, but from the [data type map|http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/apb.htm#sthref509] in the documentation, I would expect that it would work so long as the SQL Server ODBC driver maps the IMAGE data type to SQL_LONGVARBINARY
Justin -
Apex_util.get_blob_file?
Dears ,
i want to display the image in sidebar region , i make all steps :
1- add column in the table
( FLAG blob ,
FILENAME varchar2(4000),
MIMTYPE varchar2(4000),
FILESIZE varchar2(4000)
)2- create new region html type and but in condition PL/SQL function body return boolean
declare
begin
if :P11_COUNTRY_ID is not null then
for c1 in (select nvl(dbms_lob.getlength(flag),0) l
from TM_COUNTRIES
where COUNTRY_ID = :P11_COUNTRY_ID)
loop
if c1.l > 0 then
return true;
end if;
end loop;
end if;
return false;
end;3- under region i add item page type as display only , in PL?SQL function body i put this code
return '<img src="'||apex_util.get_blob_file_src('P11_FLAG',:P11_COUNTRY_ID)||'" />';in condition type Exists (SQL query rturn at least one row )
SELECT MIMTYPE from TM_COUNTRIES where COUNTRY_ID = :P11_COUNTRY_ID and MIMTYPE like 'image%'after run the page the image not display , but i found this error in the region
<img src="apex_util.get_blob_file?a=100&s=208992680627601&p=11&d=5841075134700438&i=5840352480700430&p_pk1=83&p_pk2=&p_ck=2DEC9AEF47B40880203EF3AEF6C597D5" />
please advice
Thanks
MaieHi,
3- under region i add item page type as display only , in PL?SQL function body i put this code Why do not use Display Image Item Type ???
Regards,
Fateh -
Oracle text indexed view is possible
Oracle text indexed view is possible???
ok,
My table name is T_DOC :
ID----------------> NUMBER(30)
DESCRIPTION-------> VARCHAR2(2000 BYTE)
DOC---------------> BLOB
FILENAME----------> VARCHAR2(2000 BYTE)
MIMETYPE----------> VARCHAR2(2000 BYTE)
LAST_UPDATE_DATE--> DATE
T_DOC
| Id | DESCRIPTION | DOC | FILENAME | MIMETYPE | LAST_UPDATE_DATE |
| 1 | THE DOG | *(!BLOB) | THE_CAT.PDF | application/pdf | 20/05/2010 15:06:15 |
| 2 | THE BIRD | **(!BLOB) | THE_BIRD.PDF | application/pdf | 20/05/2010 15:06:15 |
| 3 | THE HUMAN AND CAT | ***(!BLOB) | THE_HUMAN.PDF | application/pdf | 20/05/2010 15:06:15 |
* is a document .pdf with content: "the dog and cat"
** is a document .pdf with content: "the bird in house"
*** is a document .pdf with content: "the human from USA"
Index the columns DESCRIPTION, DOC (document content), FILENAME
begin
ctx_ddl.create_preference('idxDoc_lx', 'BASIC_LEXER');
ctx_ddl.set_attribute (' idxDoc_lx ', 'MIXED_CASE', 'NO');
end;
begin
ctx_ddl.create_preference('idxDoc_ds', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute ('idxDoc_ds', 'COLUMNS', 'DOC, FILENAME, DESCRIPTION');
end;
CREATE INDEX IDX_DOC
ON T_DOC (FILENAME)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS ('lexer idxDoc_lx
datastore idxDoc_ds
filter CTXSYS.AUTO_FILTER
sync (on commit)');Search Query:
select ID
from T_DOC
where CONTAINS (DOCUMENTO, 'CAT', 1) > 0 RESULT ID = 1
WHY NOT ALSO Returned ID 3 ?????? -
Image rendered in HTML region on same page
I am using the Oracle OBE tutorial below to insert and manage a photo associate with an employee record. Howerver, clinking on the download link renders the image in a separte browser window. Is there any way to render the photo from the report and/or form in an HTML region on the same page? The report and form appear on the same page as well. Specific code or reference to such would be greatly appreciated.
Andy, I do appreciate you responding so quickly. The scenario I am trying to accomplish is the following: I have a table as follows:
Name Null? Type
SIA_ID NOT NULL NUMBER(20)
LOGIN_ID VARCHAR2(20)
LAST_NAME VARCHAR2(60)
FIRST_NAME VARCHAR2(60)
EMAIL VARCHAR2(40)
MENTOR VARCHAR2(1)
PHOTO BLOB
FILENAME VARCHAR2(255)
MIMETYPE VARCHAR2(255)
LAST_UPDATE_DATE DATE
I have a Form with report that allows me to upload photos in the form and show the PHOTO column as a DOWNLOAD link in the report. I also have the ID column as a link to the form so I can edit details of that record. Is there any way with this scenario to simply allow the PHOTO (blob) to be shown in a small HTML region on the same page as this report and form? I'm thinking that I might be able to use an IMG tag in the HTML region but I'm not sure how to format it. So I guess I'd like to see the details for the record from the report in the form other than the photo which would show up in a separate region on the same page.
Thanks again. -
ROWTYPE to get better query ?
Hello,
I have two identical tables:
PHOTOS_TEMP AND IMAGES_TEST
(ID PK number ,
content blob,
filename varchar2 (200),
mimetype varchar2 (200),
filesize varchar2 (200),
res_id FK number,
watermarked varchar2 (1))I have CODE 1, I want to make it more effecient perhaps by using %ROWTYPE,
So, I tried CODE 2, but it did not work. It tells, "Too many values .... CONTENT must be declared ...."
Can you plesae tune Code 1 ??
h1. CODE 1 is working fine
DECLARE
type source_col is table of blob index by pls_integer ;
V_source source_col;
type id_col is table of number index by pls_integer ;
V_id id_col;
type char_col is table of IMAGES_TEST.FILENAME%TYPE index by pls_integer ;
V_filename char_col;
V_mimetype char_col;
begin
select content,filename,mimetype,id bulk collect into
V_source,v_filename,v_mimetype,v_id from photos_temp
where temp = :P700_TEMP_IMAGE for update ;
for i in V_source.first .. V_source.last
loop
ORDSYS.ORDImage.process(V_source(i), 'fixedScale=800 500');
end loop;
forall i in V_source.first .. V_source.last
insert into IMAGES_test
(res_id ,CONTENT,filename,mimetype,filesize,watermarked)
values
(:P700_res_ID ,V_source(i),V_filename(i),V_mimetype(i),
dbms_lob.getlength(V_source(i)), 'Y');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;h1. CODE 2 supposed to be more efficient, but not working ?
DECLARE
type new_row is table of IMAGES_TEST%rowtype index by pls_integer ;
v_row new_row;
begin
-- This may collect more than one row
select * bulk collect into
v_row from photos_temp
where temp = :P700_TEMP_IMAGE for update ;
for i in v_row.id.first .. v_row.id.last
loop
ORDSYS.ORDImage.process(v_row.content(i), 'fixedScale=800 500');
end loop;
forall i in v_row.id.first .. v_row.id.last
insert into IMAGES_test
(res_id ,CONTENT,filename,mimetype,filesize,watermarked)
values
(:P700_res_ID ,v_row.contnet(i),v_row.filename(i),v_row.mimetype(i),
dbms_lob.getlength(v_row.content(i)), 'Y');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;Best Regards,
Fateh
Edited by: Fateh on Nov 26, 2012 5:22 AMhi,
In your CODE 1
select content,filename,mimetype,id bulk collect into
V_source,v_filename,v_mimetype,v_id from photos_temp
where temp = :P700_TEMP_IMAGE for update ;
-- temp is not a collumn name nor a variable name
...So I think that does not work.
In code 2 you must use the index "( i)" on the table variable and not on the attribute. So:
v_row.contnet(i) --THIS IS WRONG!
v_row(i).contnet -- This is OK
Also:
v_row.id.first --THIS IS WRONG!
v_row.first --This is OK
Below is an working example:
insert into photos_temp (id ,filename) values ( 1,'peter');
insert into photos_temp (id ,filename) values ( 2,'Fateh');
commit;
DECLARE
type new_row is table of IMAGES_TEST%rowtype index by pls_integer ;
v_row new_row;
begin
select * bulk collect into
v_row from photos_temp
--where temp = :P700_TEMP_IMAGE
for update ;
--for i in v_row.id.first .. v_row.id.last
for i in v_row.first .. v_row.last
loop
DBMS_OUTPUT.PUT_LINE('Id: ' || v_row(i).id || ' filename: ' || v_row(i).filename);
end loop;
end;
Result:
Id: 1 filename: peter
Id: 2 filename: FatehAnd in your case for code 2 simplyfied:
DECLARE
type new_row is table of IMAGES_TEST%rowtype index by pls_integer ;
v_row new_row;
begin
select * bulk collect into
v_row from photos_temp
--where temp = :P700_TEMP_IMAGE
for update ;
--forall i in v_row.id.first .. v_row.id.last
forall i in v_row.first .. v_row.last
insert into IMAGES_test
(id ,filename)
values
(v_row(i).id, v_row(i).filename);
end;
select
id
,filename
from
images_test;
Result:
ID FILENAME
1 peter
2 Fateh Whoever this works in:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE 11.2.0.1.0 Production"
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
I think in oracle 9 you must use seperate table variables and not one table variable of a scalar type.
Regards,
Peter -
Javascript Client Object Model OpenBinary Method?
Hello,
Is there any way i can read document stream in javascript like we can call OpenBinary method in C#? Is there any replacement of SPFile.OpenBinary method? I have seen lot of samples for uploading documents to the document libary in JavaScript but no sample
contains information about reading document stream from SharePoint.
I want to create SharePoint hosted app to read the document from document library and send the Stream to REST service. As this is SharePoint hosted app, i have only option to use JavaScript for document handling.
Regards,
Muhammad Irfan Khan
KhanGHello Mikael,
i am facing same problem and with help of your blog i am unable to solve this with help of your blog. below is my code can you help me with this.
function SaveToDisk_blob(blobURL, fileName)
var reader = new FileReader();
var blob = new Blob([blobURL.body], { type: "application/" + fileName.split(".")[1] + "" });
window.navigator.msSaveBlob(blob, fileName);
function downloadFile(rest_url,filepath, fileName)
var dfd = $.Deferred();
if (!window.ActiveXObject)
var save = document.createElement('a');
save.href = filepath;
save.target = '_blank';
save.download = fileName || 'unknown';
var event = document.createEvent('Event');
event.initEvent('click', true, true);
save.dispatchEvent(event);
(window.URL || window.webkitURL).revokeObjectURL(save.href);
dfd.resolve(true);
else if (!!window.ActiveXObject && document.execCommand)
var appweburl = _spPageContextInfo.webAbsoluteUrl
$.getScript(appweburl + "/_layouts/15/SP.RequestExecutor.js", function () {
var executor = new SP.RequestExecutor(appweburl);
//if (requestInfo.binaryStringResponseBody) {
// responseInfo.body = xhr.response;
executor.executeAsync(
url: rest_url,
type: "GET",
binaryStringResponseBody: true,
success: function (blobURL)
SaveToDisk_blob(blobURL, fileName)
dfd.resolve(true);
error: function (xhr)
console.log(xhr);
dfd.reject();
return dfd.promise()
function call_to_rest_binarystring(rest_url)
var ajax_call = $.ajax({
url: rest_url,
method: "GET",
binaryStringResponseBody: true,
headers:
"accept": "application/json; odata=verbose"
return ajax_call;
the file which is download after this, it gets corrupted. -
Formhistory & webhistory deleted on update
I have firefox 3.6.18 but when I wanna update to v5.0 my formhistory and webhistory are deleted.
I go to see in my profile folder and I can see 2 new files with corrput extension, formhistory.sqlite.corrupt and places.sqlite.corrupt.
I don't like losing the data, so what can I do?Well, I am apparently the only person in the world using the file browse item to a custom table in APEX 3.1. :-)
Meanwhile, should anyone else hit a similar problem, I worked around the issue by adding a trigger that detects if there was a blob before and there is not a blob now and puts everything back into place before writing the record. I made it a separate trigger from the main before insert/update trigger I use so if I really do want to delete the file, I can temporarily disable this trigger, delete the blob/filename/mimetype and re-enable the trigger. If you provide the user the ability to delete the file from the front end, you can either disable/enable the trigger in your front-end process that deletes the blob or add a column in the table that the trigger will read and not replace the empty blob if ":new.delete_file_flag = 'Y'. The trigger I'm using is:
BEGIN
/*Trigger is to workaround possible bug in APEX where the BLOB file gets overwritten by a blank
BLOB when record is updated without re-uploading BLOB. Disable to erase the BLOB from the record.*/
IF DBMS_LOB.getlength (:new.doctor_cv) = 0 AND DBMS_LOB.getlength (:old.doctor_cv) != 0 THEN
:new.doctor_cv := :old.doctor_cv;
:new.filename := :old.filename;
:new.mimetype := :old.mimetype;
END IF;
END;
Rgds/Mark M. -
Conserving filename with upload via portal form into blob type
Hi
I have a little question. Is there any chance to conserve a filename, which was uploaded into blob column via portal form and then create link for this file with the same name?
nullVlasta,
You certanly can save the original filename in your form, to do that you will need to add a FILENAME varchar2 column to your table and write a simple Javascript (search this forum for examples) to copy the fileselect value with onChange event. So, when you submit the form with your file the original name will be stored in you table.
Thanks,
Dmitry
Maybe you are looking for
-
Internet radio and Apple TV update 6.0
Has internet radio been eliminated with the 6.0 update to Apple TV, or is it hidden somewhere as it is in the new iTunes update. The primary reason I bought a 2nd Apple TV was strictly for internet radio through a housewide sound system. To remove i
-
How to start with Master data management
Hi All, I want to start with Master Data Management. Can any one provide me proper material to get the knowledge on Master Data Management Integration. And What is the relationship between XI.and for starting MDM what all settings i have to do??? Its
-
Not able to connect to other system
Hi All, Currently have two Solaris 10 servers connected via a dumb Hub. I'm unable to ping either box but they can ping themselves. I have double checked physical connections and the following files; /etc/hosts - verified that all devices are listed
-
Dear all, After the application of SP10 TM 110, the system is raising a dump when selecting the tab Cargo Management in a Ocean Freight Booking. It seems like attribute CONT_CNT_VAL_AQ_CA is missing after the SP upgrade. I havent found any note about
-
SAP TEM Error with Manual Output of Correspondence for Prebookings
Hi All This is the first time I've posted a question so apologies if I'm in the wrong place and also my knowledge/experience of SAP TEM is very limited so please excuse my ignorance. There appears to be a problem when using the MS Word (standard lett