Downloading documents from Customer table

Hi,
I am getting the following error message, when I execute these codes.  Please advise.
ERROR at line 25: PLS-00103: Encountered the symbol "FILE_NAME" when expecting one of the following:

   . ( ) , * @ % & | = - + < / > at in is mod remainder not
   range rem => ..  <> or != or ~= >= <= <>
   and or like LIKE2_ LIKE4_ LIKEC_ as between from using ||
   multiset member SUBMULTISET_
The symbol "." was substituted for "FILE_NAME" to continue.
1. CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
2. v_mime VARCHAR2(48);
3. v_length NUMBER;
4. v_file_name VARCHAR2(2000);

CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM file_subjects
WHERE id = p_file;
--
-- set up HTTP header
--
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from
windows
owa_util.mime_header( nvl(v_mime,'application/octet'),
FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a
save as
htp.p('Content-Disposition: attachment; filename="'||substr(v_
file_name,instr(v_file_name,'/')+1)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end download_my_file;
/

Open in new window

JohnSrinivassanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sdstuberCommented:
looks like your commented lines aren't fully commented...

try this...

CREATE OR REPLACE PROCEDURE download_my_file(p_file IN NUMBER)
AS
    v_mime        VARCHAR2(48);
    v_length      NUMBER;
    v_file_name   VARCHAR2(2000);
    lob_loc       BLOB;
BEGIN
    SELECT mime_type, blob_content, NAME, DBMS_LOB.getlength(blob_content)
      INTO v_mime, lob_loc, v_file_name, v_length
      FROM file_subjects
     WHERE ID = p_file;

--
-- set up HTTP header
--
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
    OWA_UTIL.mime_header(NVL(v_mime, 'application/octet'), FALSE);
-- set the size so the browser knows how much to download
    HTP.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
    HTP.p(   'Content-Disposition: attachment; filename="'
          || SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1)
          || '"'
         );
-- close the headers
    OWA_UTIL.http_header_close;
-- download the BLOB
    WPG_DOCLOAD.download_file(lob_loc);
END download_my_file;
/
 

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnSrinivassanAuthor Commented:
Stuber,
Thanks for your timely support.  Be in touch.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.