Oracle APEX SQL

DECLARE
  v_test_nbr NUMBER;
  v_check_exists NUMBER;
BEGIN
  BEGIN
    v_test_nbr := to_number(:P6_TEXT_FIELD);
  EXCEPTION
  WHEN OTHERS THEN
    -- or catch 1722 (invalid number) and 6502 (char to number conversion error)
    v_test_nbr := NULL;
  END;

  IF v_test_nbr IS NOT NULL
  THEN
  -- if v_test_nbr is not null then the field should be numerically valid
  -- if it isn't then this code would be skipped and this validation
  -- will not throw an error.
  -- However, the previous validation will still fail when text is entered, 
  -- so this shouldn't matter.
    BEGIN
      SELECT 1
      INTO v_check_exists
      FROM my_table
      WHERE column_name = :P6_TEXT_FIELD;
    EXCEPTION 
    WHEN no_data_found THEN
      v_check_exists := 0;
    END;

    IF v_check_exists = 1 
    THEN
      RETURN 'A record with this key already exists';      
    END IF;
  END IF;

  RETURN NULL;
END;
No. Subject Author Date Views
92 SELECT last_name FROM admin 2018.12.12 2132
91 IMP admin 2018.10.08 2092
90 CREATE TABLE admin 2018.09.25 1823
89 Change Admin PASSWORD admin 2018.07.31 1511
88 VERY IMPORTANT admin 2018.06.26 1460
87 IF/ELSE ... CASE WHEN admin 2018.06.25 1065
86 MISSIONARY_SUB admin 2018.06.25 1349
85 eeeeee admin 2018.06.21 1338
84 TABLE PRINT admin 2018.06.18 1507
83 GP PRINT admin 2018.05.31 2422
82 How to convert DATE to NUMBER admin 2018.05.27 1497
81 DATE Compare admin 2018.05.22 1695
80 If you want to use EXISTS in a PL/SQL function returning BOOLEAN admin 2018.05.19 1395
79 use a validation function for an element in apex 5.0 admin 2018.05.19 1350
» Validation to detect text in numeric field admin 2018.05.19 1548
77 All Data DELETE from Table admin 2018.05.10 1405
76 Process admin 2018.05.05 1371
75 Oracle SQL Developer: Online Migration 3.1 admin 2018.04.25 1611
74 How to Update Oracle XE admin 2018.04.25 1380
73 Oracle APEX 5.1.4 Installation admin 2018.04.17 1359