我在visual basic中有以下代码。当我在按钮点击事件上调用它时,我收到错误' SCRIPT1015:未终止的字符串常量'。我可以从vb代码中使用这样的PL / SQL:
strInsert = "DECLARE "
strInsert = strInsert + " in_xml_value varchar2(32767) "
strInsert = strInsert + " BEGIN "
strInsert = strInsert + " in_xml_value := "
strInsert = strInsert + " '" + dv1.Table.Rows(j).Item("XML_Report")
strInsert = strInsert + "' " + "INSERT into Report (ID,USER, XML_Report)"
strInsert = strInsert + " VALUES(" + CStr(dv1.Table.Rows(j).Item("ID"))
strInsert = strInsert + ", '" + dv1.Table.Rows(j).Item("USER")
strInsert = strInsert + "', XMLTYPE.CREATEXML(in_xml_value)" + ");"
strInsert = strInsert + " commit; "
strInsert = strInsert + " END; "
clsREPORTS.strInsert = New SqlTypes.SqlString(strInsert)
调试时出现此错误:
ORA-06550: line 1, column 40:
PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
:= ; not null default character
The symbol ";" was substituted for "BEGIN" to continue.
ORA-06550: line 1, column 4078:
PLS-00103: Encountered the symbol "INSERT" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset memb
答案 0 :(得分:0)
strInsert = strInsert + " in_xml_value varchar2(32767) "
这应该以分号结尾。所以它变成了:
strInsert = strInsert + " in_xml_value varchar2(32767) ;"
此外,每条陈述都应以分号结尾,因此您需要在INSERT
之前加上分号。