IMAGE ON FORM 6i [message #415103] |
Fri, 24 July 2009 15:56  |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
HI EVERYONE
Please assist me on how to display an image(blob) on a form . i have tried all i could but still failed to display it on the form.Yes i searched the forum without any break through.
below is the code i used to create data block and upload photos (JPG). the only problem am facing is retrieving them from forms. am using form 6i 10g database.
Thankyou.
i ll applreciate if one gives me a step by step on doin this.
the below code works fine.
conn system
grant connect, resource, imp_full_database, exp_full_database to en;
grant create any directory to EN;
grant create any library to EN;
GRANT EXECUTE ON CTX_DDL en;
CONN en/en@pacific
Connected
CREATE TABLE my_docs (
id NUMBER(10) NOT NULL,
name VARCHAR2(200) NOT NULL,
doc BLOB NOT NULL
)
ALTER TABLE my_docs ADD (
CONSTRAINT my_docs_pk PRIMARY KEY (id)
);
CREATE SEQUENCE my_docs_seq;
CREATE OR REPLACE DIRECTORY documents AS 'C:\work';
CREATE OR REPLACE PROCEDURE load_file_to_my_docs (p_file_name IN my_docs.name%TYPE) AS
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO my_docs (id, name, doc)
VALUES (my_docs_seq.NEXTVAL, p_file_name, empty_blob())
RETURN doc INTO v_blob;
v_bfile := BFILENAME('DOCUMENTS', p_file_name);
Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
COMMIT;
END
;
/
-- CREATE A FOLDER NAMED WORK IN C DRIVE OF ORACLE SERVER MACHINE & PUT THE IMAGE FILE (APPL_FORM.PDF,CIMG1860.JPG)
-- YOU WANT TO STORE IN ORACLE TABLE IN THAT FOLDER. THEN EXECUTE THE PROCEDURE load_file_to_my_docs.
EXEC load_file_to_my_docs('APPL_FORM.PDF');
EXEC load_file_to_my_docs('CIMG1860.JPG');
COMMIT;
|
|
|
|
|
|
Re: IMAGE ON FORM 6i [message #415285 is a reply to message #415269] |
Mon, 27 July 2009 01:11   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
djmartin wrote on Mon, 27 July 2009 07:19 | Although you may be using Oracle Forms, your question is more SQL related that Forms related. I will move your thread.
David
|
The OP mentioned that the code does work fine, he just doesn't seem to know how to implement this in Forms. I wonder why you think this is not For128232716531729
Content-Disposition: form-data; name="msg_id"
415285
[Updated on: Mon, 27 July 2009 01:12] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|