请教oracle中向colb型字段插入超过4000长度字符的方法,oracle版的人太少了,所以来这里问,问题解决马上结帖
我有个字符串长度超过4000了,请问怎么插入进clob型字段中,请根据我的代码写个解决方法,谢谢
string str="aaaaaaaaaaaaaaaaaa.....";(长度超过4000)
string sql="insert into tablename(fid,fremark) values('1',???)";
上面问号的部分我不会写了
--------------------编程问答-------------------- 上面那个是个例子,我实际的程序还有个问题,就是我那个超过4000长度的字符串中包含逗号了,能插入进去吗?
我实际的程序如下
--------------------编程问答-------------------- 在SQL里面是怎么实现的
string str="select fid,fname,fnumber,fseq,fadress,fcustomer......";(长度超过4000)
string sql="insert into tablename(fid,fremark) values('1',???)";
问号的部分我就不知道怎么写了,请指教,变量str就是我要存入数据库的字符串,fremark是colb型
string sql="insert into tablename(fid,fremark) values('1',@参数)";
把他做为参数传入,在配置comm的时候,定义下传入参数的值。。然后运行comm
这是典型的防止SQL主入的方法
oracle也应该类似吧。。 --------------------编程问答-------------------- 小于4000的我可以插入,大于4000的就不行了,如果我那字符串中有逗号的话也不能插入 --------------------编程问答-------------------- Clob吧,最大可以支持到4GB大小,和4000char没什么关系 --------------------编程问答-------------------- Use the CLOB datatype to store large blocks of single-byte character data "out of line" inside the database. This means that when a table has a CLOB column, a row of data for that table contains a pointer or locator to the actual location of the CLOB data (so it is not "in line" with the other column values of the row).
A CLOB variable contains a locator, which then points to the large block of single-byte character data. CLOBs can be up to 4 gigabytes in size, and they participate fully in transactions. In other words, any changes you make to a CLOB (via the DBMS_LOB built-in package) can be rolled back or committed along with other outstanding changes in your transaction. CLOB locators cannot, however, span transactions or sessions.
Note: Variable-width character sets are not supported in CLOBs. --------------------编程问答-------------------- 用2L的方法试一试吧. --------------------编程问答-------------------- 我英文不好
补充:.NET技术 , C#