sql server中的left, right, substring在oracle中都用substr实现

sql server中的left, right, substring在oracle中都用substr实现, 
示例如下(仅在这里说明left和right, substring就不说了, 一样的):
sql server下的

--左取两个字符
select left('abc', 2)
---- 
ab

(1 row(s) affected)

--右取两个字符
select right('abc', 2)
---- 
bc

(1 row(s) affected)

oracle中
--左取两个字符
SQL> select substr('abc', 1, 2) from dual;

SUBSTR('ABC',1,2)
-----------------
ab

--右取两个字符
SQL> select substr('abc', -2, 2) from dual;

SUBSTR('ABC',-2,2)
------------------
bc

posted @ 2014-02-08 16:54  po-A  阅读(1299)  评论(0编辑  收藏  举报

Tushare大数据开放社区-免费提供各类金融数据和区块链数据 , 助力智能投资与创新型投资。

Python, Matlab, R, Web数据抽取学习交流。