bewe
bewe

Reputation: 49

Oracle SQL Procedure. What is the error here?

I wrote an PL/SQL procedure in Oracle APEX, and when I compile it, I get an error. I do not understand what is the cause of the error. It looks to me that the sintaxis is correct.

Here is a screen capture: https://i.sstatic.net/g0XL6.png

This is the code:

create or replace PROCEDURE imageBLOBtoHTML(  v_MimeType IN VARCHAR2 (255) := null,
                                              v_Size IN NUMBER := null,
                                              v_file_name IN VARCHAR2 (2000) := null,
                                              imageBLOB IN NOCOPY BLOB  := null )
AS
BEGIN

       --Generates HTML
       OWA_UTIL.mime_header (NVL (v_MimeType , 'application/octet'), FALSE);
       htp.p('Content-length: ' || v_Size );
       htp.p('Content-Disposition:  filename="' || SUBSTR(v_file_name , INSTR(v_file_name , '/') + 1) || '"');
       owa_util.http_header_close;

       --Stops generation of HTML
       wpg_docload.download_file(imageBLOB);
END imageBLOBtoHTML;

This is the error:

Compilation failed,line 1 (13:39:25)
PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character

Upvotes: 0

Views: 79

Answers (2)

XING
XING

Reputation: 9886

Error is at line:

  imageBLOB IN NOCOPY BLOB  :=  null 

you need to change it :

imageBLOB     IN OUT NOCOPY BLOB := ''

I would say as :

CREATE OR REPLACE PROCEDURE imageBLOBtoHTML (
   v_MimeType    IN            VARCHAR2  := '',
   v_Size        IN            NUMBER := '',
   v_file_name   IN            VARCHAR2  := '',
   imageBLOB     IN OUT NOCOPY BLOB := '')

Upvotes: 1

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59446

Joining my answer with the answer from XING it should be this one:

create or replace PROCEDURE imageBLOBtoHTML( v_MimeType IN VARCHAR2 := null,
                                             v_Size IN NUMBER,
                                             v_file_name IN VARCHAR2,
                                             imageBLOB IN OUT NOCOPY BLOB)

Permitting NULL for the other parameters (i.e. set NULL as default) does not make sense.

Upvotes: 1

Related Questions