An unexpected error with the following message occurred: For input string: ""

I'm getting the following error from ORDS when an AJAX process is executed within a page in APEX:

An unexpected error with the following message occurred: For input string: ""

The code I was using for printing the response to the HTTP stream was:

DECLARE
    L_HTTP_STATUS NUMBER;
    L_HTTP_REASON_PHRASE VARCHAR2(32767);
BEGIN
    -- ...
    APEX_JSON.INITIALIZE_OUTPUT(
        P_HTTP_HEADER => FALSE,
        P_INDENT => 4
    );
    OWA_UTIL.MIME_HEADER(
        CCONTENT_TYPE => 'application/json',
        BCLOSE_HEADER => FALSE,
        CCHARSET => NULL
    );
    OWA_UTIL.STATUS_LINE(
        NSTATUS => L_HTTP_STATUS,
        CREASON => L_HTTP_REASON_PHRASE,
        BCLOSE_HEADER => TRUE
    );
    APEX_JSON.OPEN_OBJECT();
    -- ...
    APEX_JSON.CLOSE_OBJECT();
END;

Although nothing seems wrong with it I'm still getting the error.

Upvotes: 1

Views: 1399

Answers (2)

Ziad Adnan
Ziad Adnan

Reputation: 822

For me I solved it by reinstall ORDS using the command

c:\apex\ords\bin> ORDS install

and select choice 2 create or update database pool then choice 1 basic host name and continue the defaults choices after that ORDS started with no errors

Upvotes: 0

Turns out the error was that the L_HTTP_STATUS variable was never being set, therefore was NULL, and ORDS doesn't like NULL status headers, although I wonder why is it that OWA_UTIL.STATUS_LINE allows NULL in the first place. Anyway hopefully it helps someone who is having the same error.

Upvotes: 2

Related Questions