Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No data found using apex_json in SQL Developer

Jose ArósteguiOct 7 2019 — edited Oct 16 2019

Hi expert,

I have a PLSQL to build Json error messages like this, and it's working perfectly in the ORDS service we have built:

pastedImage_0.png

This is the code:


-- Function that returns a JSON Payload


PROCEDURE error_response(p_lookup_type IN VARCHAR2,

                       p\_error\_code  IN VARCHAR2,

                       p\_error\_text  IN VARCHAR2 DEFAULT NULL) IS

l\_error\_code apexc\_lookup\_values.return\_value%TYPE;

l\_error\_text VARCHAR2(4000);

BEGIN

apex\_json.open\_object;

apex\_json.open\_object('Status');

l\_error\_code := p\_error\_code;

l\_error\_text := p\_error\_text;

BEGIN

  -- Query for the text related with the error message

  SELECT lv.display\_value

    INTO l\_error\_text

    FROM apexc\_lookups       l

        ,apexc\_lookup\_values lv

   WHERE l.lookup\_type = p\_lookup\_type

     AND l.lookup\_id = lv.lookup\_id

     AND lv.return\_value = l\_error\_code;

EXCEPTION

  WHEN OTHERS THEN

    -- If not found, return Unexpected Error (-1)

    l\_error\_code := '-1';

    IF l\_error\_text IS NULL THEN

      l\_error\_text := 'Unexpected error. Please contact with System Administrator.';

    END IF;

END;

apex\_json.write('StatusCode', nvl(l\_error\_code, 0));

apex\_json.write('StatusMessage', nvl(l\_error\_text, 0));

apex\_json.close\_object;    

apex\_json.close\_object;       

END error_response;

But when we run it from SQL Developer we get this error:

pastedImage_1.png

Is there any way to capture HTP output directly in SQL Developer?

Thanks,
Jose.

Comments
Post Details
Added on Oct 7 2019
11 comments
676 views