3

Could you please suggest me common PL/SQL input validation technique / utility: digits only, string size restriction, email address, SSN, etc. I've made some google search, but didn't find any library package or source code. I don't want to re-invent the wheel :)

Thank you for your help.

3
  • 1
    What version of Oracle? What version of Forms? Are you trying to validate the data in Forms? Or in stored procedures in the database? Commented Jul 26, 2011 at 18:29
  • Oracle-11, need to validate input "foo & bar" like: "mysite.com?foo=123&bar=xyz" in stored procedures. Thanks. Commented Jul 26, 2011 at 18:35
  • to Codo: thank you for suggestion Codo. If I don't find any utility I'll use this technique. Commented Jul 26, 2011 at 18:48

2 Answers 2

3

depending on what version of oracle and/or forms i would defenetly use regexp_like if i'd need to validate a string like "mysite.com?foo=123&bar=xyz"

Sign up to request clarification or add additional context in comments.

Comments

0

There's a script named dbsmany.sql that perhaps you can find useful in {ORACLE_HOME}/rdbms/admin/dbmsany.sql

Is not exactly what you're looking for, but has an interesting approach, the anydata type.

CREATE OR REPLACE FUNCTION getData(p_x IN sys.anyData)
RETURN VARCHAR2 IS 
 l_num      NUMBER;
 l_date     DATE;
 l_varchar2 VARCHAR2(4000); 
BEGIN
  CASE p_x.gettypeName
  WHEN 'SYS.NUMBER' THEN
    IF (p_x.getNumber(l_num) = dbms_types.success) THEN
      l_varchar2 := l_num;
    END IF;
  WHEN 'SYS.DATE' THEN
    IF (p_x.getDate(l_date) = dbms_types.success) THEN
      l_varchar2 := l_date;
    END IF;
  WHEN 'SYS.VARCHAR2' THEN
    IF (p_x.getVarchar2(l_varchar2) = dbms_types.success) THEN
      NULL;
    END IF;
  ELSE
    l_varchar2 := '** unknown **';
  END CASE;

  RETURN l_varchar2;
END getData;
/

For more public and useful PL/SQL scripts: http://psoug.org/browse.htm

1 Comment

well... it's a bit different from what I was looking for. But thanks anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.