Oracle 11g 中字符溢出到多个列?
这与问题相关:如何在 Oracle 11g 中存储无限字符?< /a>
如果我需要的最大字符数是 8000 个字符,我可以再添加 3 个 varchar2 列吗,这样我就有 4 列,每列 2000 个字符,从而获得 8000 个字符。因此,当第一列已满时,值将溢出到下一列,依此类推。这样的设计会不会有什么不好的副作用呢?请建议。
This is related to question: How to store unlimited characters in Oracle 11g?
If maximum I need is 8000 characters, can I just add 3 more varchar2 columns so that I will have 4 columns with 2000 char each to get 8000 chars. So when the first column is full, values would be spilled over to the next column and so on. Will this design have any bad side effects? Please suggest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为什么不直接使用
CLOB
列呢?我读了您的其他链接,但我不明白为什么您的 DBA 不喜欢这些类型的列。我的意思是,CLOB
是 Oracle 的一个重要功能,正是为了这个目的。您的公司在购买 Oracle 时为该功能付出了很多钱,那么为什么不充分利用 Oracle 的功能,而不是尝试想出一些技巧来完成数据库并非真正设计要做的事情呢?也许您不应该花时间尝试设计技巧来克服 DBA 造成的限制,而应该花一些时间教育您的 DBA 为什么 CLOB 是解决您的问题的正确功能。
当数据库具有我需要进行良好设计的功能时,我永远不会满足于糟糕的设计。如果 DBA 是问题所在,那么他们需要改变观点,或者我认为您应该去找高级管理层。
Why not just use a
CLOB
column instead? I read your other link, and I don't understand why your DBA's don't like these types of columns. I mean,CLOB
is an important feature of Oracle just for this exact purpose. And your company paid good money for that feature when buying Oracle, so why not leverage Oracle to it's fullest capabilities instead of trying to come up with hacks to do something that the DB is not really designed to do?Maybe instead of spending time trying to devise hacks to overcome limitations created by your DBAs, you should spend some time educating your DBA's on why
CLOB
s are the right feature to solve your problem.I would never be satisfied with a bad design when the DB has the feature I need to make a good design. If the DBA's are the problem, then they need to change their viewpoint or you should go to senior level management in my opinion.
我同意 dcp 的观点,即您应该使用 CLOB。但是如果与所有意义上的相反,您被迫仅使用 VARCHAR2 列“滚动自己的”无限文本,那么我不会通过向表中添加越来越多的 VARCHAR2 列来实现这一点,如下所示:
相反,我会移动 然后,
您可以使用 mytable_text 中的许多行,为每个 mytable 行插入任意多的文本。
I agree with dcp that you should be using CLOB. But if against all sense you are forced to "roll your own" unlimited text using just VARCHAR2 columns then I would not do it by adding more and more VARCHAR2 columns to the table like this:
Instead I would move the text to a separate child table like this:
Then you can insert as much text as you like for each mytable row, using many rows in mytable_text.
对 DCP 和 Tony 的出色回答进行补充:
您询问您提出的方法是否会产生任何不良副作用。以下是需要考虑的一些事项:
To add to DCP's and Tony's excellent answers:
You ask if the approach you are proposing will have any bad side effects. Here are a few things to consider: