Oracle bulk copy column mapping issue
730704Oct 28 2009 — edited Oct 29 2009Hi,
I was wondering if I must double quote columns names for column mapping:
for example the following code will return 'colum mapping is invalid'.
foreach (DataColumn col in dataTable.Columns)
{
OracleBulkCopyColumnMapping colMap = new OracleBulkCopyColumnMapping();
colMap.DestinationColumn = string.Format("\"{0}\"", col.ColumnName);
colMap.SourceColumn = col.ColumnName;
bc.ColumnMappings.Add(colMap);
}
if i change it to
foreach (DataColumn col in dataTable.Columns)
{
bc.ColumnMappings.Add(col.ColumnName,col.ColumnName);
}
Message "ORA-02373: Error parsing insert statement for table DEMO.\"system\".\nORA-00904: \"MODTIME\": invalid identifier" string
system is the table name
DEMO is the instance name
MODTIME is the last column.
I was able to reproduce the error message above using INSERT statement, it happens when I do not double quote my column names.
I have checked documentation, I can not find any reference about double quoting table or column names. I currently double quote my table name
bc.DestinationTableName = string.Format("\"{0}\"", tableName);
Otherwise it produces an error message saying table or view does exist. I was wondering if you had a similar issue and how you resolved it.
Forgot to mention:
.NET 3.5
VS 2008
Oracle 10G
Oracle.DataAcess.dll version 2.111.7.20
Update: It looks column and table names are double quoted on the oracle server. Still need to figure out how to work around this issue.
Thanks,
Telman
Edited by: user11101872 on Oct 28, 2009 10:08 AM