简体   繁体   English

ORACLE SUBSTR编号类型

[英]ORACLE SUBSTR number type

I have a query that uses the following in a select statement 我有一个在select语句中使用以下内容的查询

WHERE section_id=SUBSTR(:rId, 5, 6)

where rId is N00401E 其中rId为N00401E

Thus I am extracting the 5th and 6th characters, "01" from the rId. 因此,我从rId中提取了第5和第6个字符“ 01”。

The error I'm getting is ORA-01722: invalid number 我收到的错误是ORA-01722:无效的数字

The rId has a type number (2) rId具有类型编号(2)

I've tried TO_NUMBER but this is not working. 我已经尝试过TO_NUMBER,但这不起作用。 Can anyone help? 有人可以帮忙吗?

To extract characters 5 an 6 you should: 要提取字符5和6,您应该:

SUBSTR(:rId, 5, 2)

See the documentation . 请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM