总结
客户的数据库从10205升级到12.1.0.2之后,出现了ORA-937错误。语句在sqlplus执行没有问题。原来客户端程序使用了OLEDB数据源,cursor_sharing从exact变成force之后出现的。这个与数据库版本没关系,主要看数据源采用什么技术,如果使用了Microsoft OLEDB就会出现这个问题,把数据源换成orace odbc即可解决。
随着硬件的升级,软件也在逐步升级,你的应用程序也得升级了。要不你就落伍了,跟上时代的步伐,努力向前冲!!!
症状
You are using Microsoft OLEDB drivers and queries executed from application throws ORA-00903 or ORA-00937 with CURSOR_SHARING=FORCE or SIMILAR. It works fine from application with CURSOR_SHARING=EXACT.
The query also runs fine from SQL*Plus irrespective of CURSOR_SHARING parameter value.
原因
Errors are due to Bug 1988231. The issue is with underlying Microsoft OLEDB drivers. Youwill hit this bug if you are using Microsoft OLEDB drivers to connect to database with
CURSOR_SHARING=SIMILAR or FORCE.
Use CURSOR_SHARING=EXACT
or
Use Oracle ODBC Driver
BUG:1988231 - VISUAL BASIC EXES GET ORA-937 W/CURSOR_SHARING=FORCE, OK W/CURSOR_SHARING=EXACT