抓虫子:RA-06550...nPLS-00306: 调用 'MEETING_NOTICE_CREATE' 时参数个数或类型
抓虫子:"System.Data.OracleClient.OracleException: ORA-06550: 第 1 行, 第 7 列: \nPLS-00306: 调用 'MEETING_NOTICE_CREATE' 时参数个数或类型
这个错误折腾了我好久好久(几个小时),然后扔到一边,今天一个一个参数的排除,终于知道原因啦 T.T
实体类的属性没有赋初始值,null值插入就会出现这种错误 所以记得赋值呀,string就设为string.empty得了吧
扔个实体类的codesmith:
<%@ CodeTemplate Language="C#" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Assembly Name="System.Design" %>
<%@ Assembly Name="System.Data.OracleClient" %>
<%@ Import Namespace="System.Data.OracleClient" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Property Name="SourceTables" Type="SchemaExplorer.TableSchemaCollection" Category="Connection" Description="Tables of the sytem." %>
<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="System.Data" %>
<% WriteData();%>
<script runat="template">
// My methods here.
public void WriteData(){
Response.Write(@"private const int INT_INIT = 0;
private const string INT_STRING = string.Empty;
private const DateTime INI_DATE = System.DateTime.MaxValue;");
Response.Write("\r\n\r\n");
foreach(TableSchema table in SourceTables){
//Response.Write("public class "+table.Name+"\r\n{\r\n");
foreach(ColumnSchema column in table.Columns){
Response.Write("private "+GetDbType(column.DataType)[0]+" _"+column.Name.ToLower()+ GetDbType(column.DataType)[1] + ";\r\n");
Response.Write("///<summary>\r\n///"+column.Description+"\r\n///</summary>\r\n");
Response.Write("public "+GetDbType(column.DataType)[0]+" "+column.Name+"\r\n{\r\n");
Response.Write("get{return _"+column.Name.ToLower()+";}\r\n");
Response.Write("set{_"+column.Name.ToLower()+"=value;}\r\n}\r\n\r\n");
}
//Response.Write("\r\n}\r\n");
}
}
public string GetDbTypeStr(System.Data.DbType type){
return type.ToString();
}
public string[] GetDbType(System.Data.DbType type){
string ret=string.Empty;
string iv = string.Empty;
switch(type){
case DbType.String :
ret="string";
iv=" = INI_STRING";
break;
case (DbType)System.Data.OracleClient.OracleType.Number:
case DbType.Int32 :
ret="int";
iv=" = INI_INT";
break;
case DbType.Int16 :
ret="short";
iv=" = INI_INT";
break;
case DbType.Int64 :
ret="int";
iv=" = INI_INT";
break;
case DbType.DateTime :
ret="DateTime" ;
iv=" = INI_DATE";
break;
case DbType.Boolean:
ret="bool";
break;
case DbType.Decimal:
ret="decimal";
break;
case DbType.Double:
ret="double";
break;
}
return new string[]{ret,iv};
}
</script>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Assembly Name="System.Design" %>
<%@ Assembly Name="System.Data.OracleClient" %>
<%@ Import Namespace="System.Data.OracleClient" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Property Name="SourceTables" Type="SchemaExplorer.TableSchemaCollection" Category="Connection" Description="Tables of the sytem." %>
<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="System.Data" %>
<% WriteData();%>
<script runat="template">
// My methods here.
public void WriteData(){
Response.Write(@"private const int INT_INIT = 0;
private const string INT_STRING = string.Empty;
private const DateTime INI_DATE = System.DateTime.MaxValue;");
Response.Write("\r\n\r\n");
foreach(TableSchema table in SourceTables){
//Response.Write("public class "+table.Name+"\r\n{\r\n");
foreach(ColumnSchema column in table.Columns){
Response.Write("private "+GetDbType(column.DataType)[0]+" _"+column.Name.ToLower()+ GetDbType(column.DataType)[1] + ";\r\n");
Response.Write("///<summary>\r\n///"+column.Description+"\r\n///</summary>\r\n");
Response.Write("public "+GetDbType(column.DataType)[0]+" "+column.Name+"\r\n{\r\n");
Response.Write("get{return _"+column.Name.ToLower()+";}\r\n");
Response.Write("set{_"+column.Name.ToLower()+"=value;}\r\n}\r\n\r\n");
}
//Response.Write("\r\n}\r\n");
}
}
public string GetDbTypeStr(System.Data.DbType type){
return type.ToString();
}
public string[] GetDbType(System.Data.DbType type){
string ret=string.Empty;
string iv = string.Empty;
switch(type){
case DbType.String :
ret="string";
iv=" = INI_STRING";
break;
case (DbType)System.Data.OracleClient.OracleType.Number:
case DbType.Int32 :
ret="int";
iv=" = INI_INT";
break;
case DbType.Int16 :
ret="short";
iv=" = INI_INT";
break;
case DbType.Int64 :
ret="int";
iv=" = INI_INT";
break;
case DbType.DateTime :
ret="DateTime" ;
iv=" = INI_DATE";
break;
case DbType.Boolean:
ret="bool";
break;
case DbType.Decimal:
ret="decimal";
break;
case DbType.Double:
ret="double";
break;
}
return new string[]{ret,iv};
}
</script>
愿一路奔跑不退缩,到目前一直从事.Net的B/S,C/S企业应用研发