Forum Stats

  • 3,768,303 Users
  • 2,252,772 Discussions
  • 7,874,521 Comments

Discussions

How to use JSON-like Objects in PLSQL - APEX 19.2

McRivers
McRivers Member Posts: 66 Red Ribbon
edited Jun 4, 2021 12:31PM in APEX Discussions

This isn't an APEX specific question, but didn't know if the fact that I'm using APEX presents APIs that may help that native PLSQL does not have. I'm using Oracle database 19c with APEX 19.2.

I have a function that will validate if a password meets specified guidelines. Sometimes I just want to know if the password is valid (Yes or No), other times I will want to also include the validation errors to display back to the user (adding to APEX error stack - i now how to do this).

Based on this, is there a way to return a PLSQL object similar to JSON or JavaScript using PLSQL? If so, how would I build the object in the validate_password PLSQL function? And how would I be able to utilize this object in other PLSQL packages/functions/etc.? Any links to examples or documentation for me to read would be greatly appreciated.

CREATE OR REPLACE FUNCTION validate_password(p_password IN VARCHAR2)

RETURN [OBJECT]


Where [OBJECT], would take some form of:


{ valid: "Y" or "N",

  errors: [

"Must contain one uppercase",

"Must contain one lowercase"...

  ]

}

Best Answer

Answers