string strsql="update table set name1='aa' where id='bb';\r\n update table set name2='aa' where id='cc'"这样执行的时候报错 提示 无效的字符,出错在“\r\n”
pl sql 输入 update table set name1='aa' where id='bb';\r\n update table set name2='aa' where id='cc' 会报错,必须写成两行
update table set name1='aa' where id='bb'
update table set name2='aa' where id='cc'
所以
strsql 中间怎么加换行啊 啊
pl sql 输入 update table set name1='aa' where id='bb';\r\n update table set name2='aa' where id='cc' 会报错,必须写成两行
update table set name1='aa' where id='bb'
update table set name2='aa' where id='cc'
所以
strsql 中间怎么加换行啊 啊
stringbuilder。appendline(update table set name1='aa' where id='bb';)
stringbuilder。appendline(update table set name2='aa' where id='cc';)
string strsql=stringbuilder.toString()
stringbuilder.appendline(update table set name2='aa' where id='cc' ;)
string strsql =stringbuilder.toString()
还是不行啊 啊啊 啊啊
update table set name2='aa' where id='cc'";拼字符串的话每个前都要加@string strsql=@"update table set name1='aa' where id='bb';"+@"
update table
set name2='aa' where id='cc'";
update table set name2='aa' where id='cc'";不行啊
C# 里 报错 无效字符 ,oracle 是不是不能用“;” 啊
update TB_VG set seq = 1, vessel_id = 'Jin14', vessel_type = 'TRACK' where batch_number = '20837' and train_id = '0233086';
update TB_VG set seq = 2, vessel_id = 'Jin14', vessel_type = 'TRACK' where batch_number = '20992' and train_id = '0233110';
end;
总结如下:
以begin开始,以end;结尾(end后的分号不能省),中间的每个sql语句要以分号;结尾在实际编码中,发现即使这样也会有错误发生,把sql语句中的换行符替换成空格就可以了
比较稳妥的编码方式是:
1、以正常的方式编写sql,根据阅读与编写的需要,中间肯定会有换行符
2、在执行之前进行替换:strSql = strSql.Replace("r\n", " ").Replace('\n', ' ');如果不采用这种方式,可能的异常有:ORA-00933: SQL 命令未正确结束(如果sql没有以分号结尾)
ORA-00911: 无效字符(如果未加begin 和 end)
ORA-06550: 第x行, 第xxx列: PLS-00103: 出现符号 "end-of-file"在需要下列之一时:......(如果end后面没有;分号)
ORA-06550: 第x行, 第xxx列: PLS-00103: 出现符号 ""在需要下列之一时:......(语句之间有换行符)