How to limit the special characters from being accepted by specific column.? can this be done with REGEXP_LIKE ? Apart from alphanumerics below are the special characters to be allowed from the text field and constraints cant be added in definition. Have to handle this case statement when not matched then raise error else populate the same value.
!
#
$
%
&
space
(
)
+
,
-
.
/
:
;
<
=
>
?
@
[
\
]
_
DECLARE
A VARCHAR2(100);
B VARCHAR2(100);
BEGIN
A :='_ _\@?=><?:;:>./.-+(%$#!;:aA10b$a9#%-.(@B=Aa1+z0,!#$% ),(+,-./;_ <\_:<>=?@\_ ';
SELECT CASE WHEN regexp_like(A,'^[A-Za-z0-9!#$%()+,-./;:<>=?@\_&[:space:]]+$')
THEN 'TRUE' ELSE 'FALSE' END CASE INTO B
FROM DUAL;
DBMS_OUTPUT.PUT_LINE(B);
END;
Tried below and got the required output. Thanks.
DECLARE
A VARCHAR2(100);
B VARCHAR2(100);
BEGIN
A :='_ _\@?=><?:;:>./.-+(%$#!][;:aA10b$a9#%-.(@B=Aa1+z0,!#$% ),(+,-./;_ <\_:<>=?@\_ [ ';
SELECT CASE WHEN regexp_like(A,'^[][[:alnum:][:space:]!#$%()+,-./;:<>=?@\\_&]+$')
THEN 'TRUE' ELSE 'FALSE' END CASE INTO B
FROM DUAL;
DBMS_OUTPUT.PUT_LINE(B);
END;