如何在Spring Boot / Oracle中自动插入字符
我想为特定产品生成代码“ AAA”。下一个条目将是“ AAB”。 并继续直到“ aaz”。一旦“ aaz”在新生成的密钥上,就会是“ aba”,依此类推。
AAA ABA
AAB ABB
AAC ABC
AAD ABD
AAE ABE
. .
. .
. .
AAZ ABZ
上表是我需要的示例。我该如何在Spring Boot中进行? 我正在使用Spring-Boot作为后端技术,前端的角度和数据库的Oracle。
I would like to generate a code "AAA" for a specific product. And the next entry would be "AAB".
And goes on till "AAZ". Once "AAZ" is over the newly generated key would be "ABA" and so on.
AAA ABA
AAB ABB
AAC ABC
AAD ABD
AAE ABE
. .
. .
. .
AAZ ABZ
The above table is an example that I need. How can I do it in spring boot?
I'm using spring-boot as backend technology, Angular for the frontend, and oracle for the database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Oracle中,从版本12中,使用
Identity
列生成顺序数字,然后使用虚拟列从数字创建字符序列:但是,您可能会更好地使用基础数字列,然后在要 display 值时在前端中生成字符串值。
db<> fiddle
In Oracle, from version 12, use an
IDENTITY
column to generate sequential numbers and then use a virtual column to create the character sequence from the number:However, you would probably be better to just use the underlying numeric column and then generate the string value in the front-end when you want to display the value.
db<>fiddle here