开发者

Does Oracle 10g comply with the ANSI SQL-1992 substring function standard?

According to the ANSI SQL-1992 standard, page 132, this is the syntax for the ANSI substring function:

<character substring function> ::=
    SUBSTRING <left paren> <character value expression> FROM <start position>
    FOR <s开发者_开发问答tring length> ] <right paren>

A quick test in SQL developer on an oracle 10g schema:

SELECT SUBSTRING('ASDF' FROM 1 FOR 1) FROM DUAL;

Results in:

ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:
Error at Line: 1 Column: 28

Does this mean Oracle 10g does not comply with this particular ANSI standard?

I simply would like to use an ANSI standard substring function instead of a vendor specific one.


oracle documentation for SUBSTR

but you can check this http://troels.arvin.dk/db/rdbms/#functions-SUBSTRING

Doesn't provide the standard SUBSTRING function. Provides SUBSTR(input,start-pos[,length]) instead (i.e. length is optional). Oracle provides a number of SUBSTR-variants (SUBSTRB, SUBSTRC, SUBSTR2, SUBSTR4, same syntax as for SUBSTR), mainly for handling various kinds of non-latin-only string-types. Oracle doesn't have support for string-extraction with the special SQL-style regular expressions. Instead, it has the REGEXP_SUBSTR function which offers string extraction, using POSIX-style regular expression pattern matching.


Try this

SELECT SUBSTRING('ASDF' ,1,1) FROM DUAL;

It will work in any standard

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜