如何得到包括标点符号(')的长度?

时间:2013-06-19 14:07:43

标签: sql oracle

如何获得包含标点符号 ' 的长度? 示例: -

SELECT LENGTH('A','B','C','D','E','F','G','H','I') FROM dual

1 个答案:

答案 0 :(得分:0)

SELECT '''A'',''B'',''C'',''D'',''E'',''F'',''G'',''H'',''I''' FROM DUAL;
-- 'A','B','C','D','E','F','G','H','I'

SELECT LENGTH('''A'',''B'',''C'',''D'',''E'',''F'',''G'',''H'',''I''') FROM DUAL;
-- 35

OR

DECLARE
    l_str VARCHAR2(100) := q'['A','B','C','D','E','F','G','H','I']';
BEGIN
    DBMS_OUTPUT.PUT_LINE(LENGTH(l_str));
END;
-- 35