|
Re: How to show text/data in Textarea from File without query. [message #380522 is a reply to message #380504] |
Mon, 12 January 2009 03:28 |
dr.s.raghunathan
Messages: 540 Registered: February 2008
|
Senior Member |
|
|
hi,
hope you have created page variable ie p1_ p followed with page number and your variable name. you shall give default value in it. if you need to store some derived data into this field you shall write pl/sql or before header process. infact it is the simplest thing on creation of page. or I misconstrued your requirement.
yours
dr.s.raghunathan
ps : if your interest on LOV or select list then the process little bit different.
[Updated on: Mon, 12 January 2009 03:30] Report message to a moderator
|
|
|
|
Re: How to show text/data in Textarea from File without query. [message #380727 is a reply to message #380540] |
Tue, 13 January 2009 02:53 |
dr.s.raghunathan
Messages: 540 Registered: February 2008
|
Senior Member |
|
|
Quote: |
P1_MYFILE ( File Browse...)
|
i am little bit confused. what do you mean by file is it a table with data content or the text file created through notepad / wordpad or any html file... what is the storage space of your file. Is it possible to store your content in any table column. or you want to list the files and your package need to select the file and open it and read it and then is it need to be stored in your textarea column. i may not have ready reconer solution still i can try and provide some solution.
yours
dr.s.raghunathan
|
|
|
|
Re: How to show text/data in Textarea from File without query. [message #380841 is a reply to message #380735] |
Tue, 13 January 2009 09:39 |
c_stenersen
Messages: 255 Registered: August 2007
|
Senior Member |
|
|
Take a look at this:
How to Upload and Download Files in an Application
All the data you insert can be found in the apex_application_files view. There's a name column in it which will hold the value of your file browse item. The file content will be in the column called blob_content, which is a blob, so it would need to be converted for you to be able to show it as text.
Blob functions:
DBMS_LOB
However, the text area may not allow you to show the file if it's too big, so you could have some problems there (varchar2 max length). Why do you need this?
declare
v_file_blob blob;
v_file_clob clob;
v_file_size integer := dbms_lob.lobmaxsize;
v_dest_offset integer := 1;
v_src_offset integer := 1;
v_blob_csid number := dbms_lob.default_csid;
v_lang_context number := dbms_lob.default_lang_ctx;
v_warning integer;
begin
dbms_lob.createtemporary(v_file_clob, true);
select blob_content into v_file_blob
from apex_application_files
where name = :MY_FILE_BROWSE_ITEM;
dbms_lob.converttoclob(v_file_clob,
v_file_blob,
v_file_size,
v_dest_offset,
v_src_offset,
v_blob_csid,
v_lang_context,
v_warning);
:MY_TEXT_AREA := v_file_clob;
dbms_lob.freetemporary(v_file_clob);
delete from apex_application_files
where name = :MY_FILE_BROWSE_ITEM;
end;
|
|
|
Re: How to show text/data in Textarea from File without query. [message #380901 is a reply to message #380841] |
Tue, 13 January 2009 21:05 |
dbhossain
Messages: 155 Registered: August 2007 Location: Dhaka
|
Senior Member |
|
|
Dear Mr. c_stenersen,
Thank you very much.
I need this bcz i want to Insert data in my database table from file(as per Client/Application requirement).It is not just upload an attachment(image or file...).
User will select his file and the file content (data) will disply in the textarea field. when he will press "Update" or whatever button, data will be inserted into the datbase table . I have done such as copying the file content and pasting it into the textArea field then update database field.
Its working perfectly. But my problem is
need a solution that user will select file using browse.. and content will take place in the textarea without copying and pasting.
Thank you for your reply. let me try with this.
------------
Kamal Hossain.
[Updated on: Tue, 13 January 2009 21:24] Report message to a moderator
|
|
|
|
Re: How to show text/data in Textarea from File without query. [message #383326 is a reply to message #382977] |
Wed, 28 January 2009 05:31 |
c_stenersen
Messages: 255 Registered: August 2007
|
Senior Member |
|
|
Can you please give an example of one of the files which gives you errors? The dbms_lob.converttoclob procedure can give you a value_error. You take these files from excel? (I assume that since you use the xls format.) These can't be directly converted to text, so I don't quite understand why you want to put them in a text area (and what you want it to look like).
From the page about the dbms_lob package I gave you a link to in my previous post:
Quote: | Table 69-17 CONVERTTOCLOB Procedure Exceptions
Exception Description
VALUE_ERROR Any of the input parameters are NULL or INVALID.
INVALID_ARGVAL One or more of the following:
- src_offset or dest_offset < 1.
- src_offset or dest_offset > LOBMAXSIZE.
- amount < 1.
- amount > LOBMAXSIZE.
|
dbms_lob.converttoclob
|
|
|
|