Home » Developer & Programmer » Forms » File Upload Show No Record (Oracle Forms 10g)
icon4.gif  File Upload Show No Record [message #473635] Mon, 30 August 2010 15:23 Go to next message
niladri
Messages: 14
Registered: January 2009
Location: USA
Junior Member
Using Forms 10g and Webutil. I am uploading my file using the following code. The Status shows file upload is Successful.. but NO Record exists in the Table...!

Here is my Table Structure:-

CREATE TABLE ST_ATTACHMENT_ACCOUNT
( ACCOUNT_CDE NUMBER(8,0) NOT NULL,
FILE_NAME VARCHAR2(100),
FILE_BLOB BLOB)
TABLESPACE PRODTABLES;

Here is my code:-

PROCEDURE UPLOAD_DB IS
lb_success boolean;
ls_full_filename varchar2(200);
ls_filenm varchar2(100);
BEGIN
go_block('ACCOUNT_ATTACHMENT');
ls_full_filename := WEBUTIL_FILE.FILE_OPEN_DIALOG('c:\','*.*','|All Files|*.*|','Upload Document for Account');

ls_filenm := substr(ls_full_filename,instr(ls_full_filename,'\',-1)+1);


last_record;
:ACCOUNT_ATTACHMENT.TITLE := ls_filenm;

INSERT INTO ST_ATTACHMENT_ACCOUNT (ACCOUNT_CDE, FILE_NAME, FILE_BLOB)
VALUES (:ACCOUNTS_DETAIL.ACCOUNT_CDE, ls_filenm, NULL);

lb_success := webutil_file_transfer.Client_To_DB_with_progress
(clientFile => ls_full_filename
,tableName => 'ST_ATTACHMENT_ACCOUNT'
,columnName => 'FILE_BLOB'
,whereClause => 'ACCOUNT_CDE ='||:ACCOUNTS_DETAIL.ACCOUNT_CDE
,progressTitle => 'Upload to Database in progress'
,progressSubTitle=> 'Please wait'
,asynchronous => true
,callbackTrigger => 'CHECK_LOB_PROGRESS'
);
if lb_success
then
message('File uploaded successfully into the Database');
else
message('File upload to Database failed');
end if;

It shows me the progress bar for upload also but I cannot see any record on the table.

SELECT dbms_lob.getlength(FILE_blob)
FROM ST_ATTACHMENT_ACCOUNT
WHERE ACCOUNT_CDE = 2;


0 rows selected... what is wrong...?
Re: File Upload Show No Record [message #473665 is a reply to message #473635] Tue, 31 August 2010 01:49 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you COMMIT?
Re: File Upload Show No Record [message #473814 is a reply to message #473665] Tue, 31 August 2010 15:09 Go to previous messageGo to next message
niladri
Messages: 14
Registered: January 2009
Location: USA
Junior Member
Yes, I did commit after the "Very First Insert" with ID = 1
Oracle Metalink told me NOT TO Insert any more.... and always keep whereClause => 'ID = 1' - hard coded...! Is it right or wrong?

I am uploading files for my individual accounts. Each account can have one to multiple files (.pdf, .docx, .txt etc)

My Table Structure:-

CREATE TABLE ST_ATTACHMENT_ACCOUNT
( ID NUMBER,
ACCOUNT_CDE NUMBER(8,0) NOT NULL,
FILE_NAME VARCHAR2(100),
FILE_BLOB BLOB)
TABLESPACE PRODTABLES;


the Upload code I have:-

ls_full_filename := WEBUTIL_FILE.FILE_OPEN_DIALOG('c:\','*.*','|All Files|*.*|','Upload Document for Account');


lb_success := webutil_file_transfer.Client_To_DB_with_progress
(clientFile => ls_full_filename
,tableName => 'ST_ATTACHMENT_ACCOUNT'
,columnName => 'FILE_BLOB'
,whereClause => 'ID = 1'
,progressTitle => 'Upload to Database in progress'
,progressSubTitle=> 'Please wait'
,asynchronous => true
,callbackTrigger => null
);


If I upload three different files one .pdf and two .docx, the last two gets the same bite size as the .pdf..! In other words it simply overrires the very first.

Does this whereClause => 'ID = 1' need to be a hard coded 'ID = 1' all the time...? Or how do I upload for each individual account?

[Updated on: Tue, 31 August 2010 15:10]

Report message to a moderator

Re: File Upload Show No Record [message #473818 is a reply to message #473814] Tue, 31 August 2010 15:56 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
How exactly did you do the commit?
did you code it or did you just press the save button?
Re: File Upload Show No Record [message #473819 is a reply to message #473818] Tue, 31 August 2010 16:17 Go to previous messageGo to next message
niladri
Messages: 14
Registered: January 2009
Location: USA
Junior Member
I did a Insert with ID=1 for the First Time and Commit it separately. As Metalink advised..! I dont know if this it correct?

From my Button (Key-next-item)

PROCEDURE UPLOAD_DB IS
lb_success boolean;
ls_full_filename varchar2(200);
ls_filenm varchar2(100);
ll_Blob_id Number;
BEGIN
go_block('ACCOUNT_ATTACHMENT');
ls_full_filename := WEBUTIL_FILE.FILE_OPEN_DIALOG('c:\','*.*','|All Files|*.*|','Upload Document for Account');


lb_success := webutil_file_transfer.Client_To_DB_with_progress
(clientFile => ls_full_filename
,tableName => 'ST_ATTACHMENT_ACCOUNT'
,columnName => 'FILE_BLOB'
,whereClause => 'ID = 1'
,progressTitle => 'Upload to Database in progress'
,progressSubTitle=> 'Please wait'
,asynchronous => true
,callbackTrigger => null
);
if lb_success
then
message('File uploaded successfully into the Database');
else
message('File upload to Database failed');
end if;



exception
when others
then
message('File upload failed: '||sqlerrm);

PROC_SAVE_FORM;

END;

N.B. PROC_SAVE_FORM procedure is calling the "Commit_Form".

Question:- Metalink asked me to keep ID=1 hard coded...? is is correct? As I said, I have Multiple Account
(individual Sales People) and each will have multiple files upload (.pdf, .doc, .txt, *.* etc).

[Updated on: Tue, 31 August 2010 16:18]

Report message to a moderator

Re: File Upload Show No Record [message #473820 is a reply to message #473819] Tue, 31 August 2010 16:36 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Try using standard.commit instead of commit_form.
Re: File Upload Show No Record [message #473994 is a reply to message #473635] Wed, 01 September 2010 21:33 Go to previous messageGo to next message
niladri
Messages: 14
Registered: January 2009
Location: USA
Junior Member
Please note, I can Upload FILE but if I upload multiple files, the subsequent 2nd and 3rd and 4th...file loose format...

Does this ID value need to hard coded as '1' all the time ? Like this...?

whereClause => 'ID = 1'

Some place I read this needs to be like :-

whereClause => 'ID = '|| X

Where X is a unique value like Sequence_No.Nextval... please let me know.

[Updated on: Wed, 01 September 2010 21:37]

Report message to a moderator

Re: File Upload Show No Record [message #474020 is a reply to message #473994] Thu, 02 September 2010 01:52 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Can we fix one problem at a time?
Have you got it saving correctly?

Is there a particular metalink note you are referring to?
Re: File Upload Show No Record [message #475433 is a reply to message #474020] Wed, 15 September 2010 02:09 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Don't use static where clause. In may case I can upload multiple docs and pdf before commit. I use dummy column with timestamp plus another dummy column as additional security on my where clause. Just populate these comlumns with unique values.
Previous Topic: Data Field Attributes
Next Topic: ORA-01422: exact fetch returns more than requested number of rows.
Goto Forum:
  


Current Time: Thu Sep 19 13:02:08 CDT 2024