ora-00932

MySQL 项目移植Oracle

自闭症网瘾萝莉.ら 提交于 2019-12-01 08:13:41
最近公司公司项目为支持oralce数据库,我们对项目进行移植,项目中使用 MyBatis需要手工对 MyBatis sql xml文件进行修改,修改过程中遇到不少问题,记录在此方便后续查看。 数据类型错误 ORA-00932 SELECT DISTINCT sg.ID, sg.CODE, sg.NAME, sg.ORGANIZATION_ID, sg.DESCRIPTION, -- to_char(sg.DESCRIPTION), sg.SORT, sg.CREATE_USER, FROM SYS_GROUP sg 原因:DESCRIPTION字段类型为NCLOB,而DISTINCT不支持对 NCLOB类型字段进行操作,使用to_char函数进行转换即可 ora-02290 违反检查约束条件 此条错误出现在执行一条新增SQL语句时,检查半天后未发现有什么异常,该语句在MYSQL也能够正常执行,后来查询资料了解到可以查询视图CONSTRAINT_NAME进行检查。 select * from dba_constraints where CONSTRAINT_NAME like '%89071'; 仔细查询之后发现出现此原因情况是表字段缺少,MYSQL环境下该表某个字段设置有默认值,但移植到ORACLE环境下未对该字段设置默认值,同时SQL语句中也未申明该字段于是出现这种错误。

How to average time intervals?

£可爱£侵袭症+ 提交于 2019-11-28 09:08:27
In Oracle 10g I have a table that holds timestamps showing how long certain operations took. It has two timestamp fields: starttime and endtime. I want to find averages of the durations given by these timestamps. I try: select avg(endtime-starttime) from timings; But get: SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got INTERVAL DAY TO SECOND This works: select avg(extract( second from endtime - starttime) + extract ( minute from endtime - starttime) * 60 + extract ( hour from endtime - starttime) * 3600) from timings; But is really slow. Any better way to turn intervals into

What is the best way to search the Long datatype within an Oracle database?

放肆的年华 提交于 2019-11-27 15:05:33
问题 I am working with an Oracle database that stores HTML as a Long datatype. I would like to query the database to search for a specific string within the HTML data stored in the Long. I tried, "select * from TABLE where COLUMN like '%form%'". This causes the following Oracle error because "like" is not supported for Long datatypes. ORA-00932: inconsistent datatypes: expected NUMBER got LONG 回答1: You can use this example without using temp table: DECLARE l_var VARCHAR2(32767); -- max length

Get the LENGTH of a LONG RAW

∥☆過路亽.° 提交于 2019-11-27 09:18:00
I have a table with a column of data type LONG RAW . How do I determine the size (in bytes) of the data in this column? If I call the LENGTH function on it, it raises ORA-00932: inconsistent datatypes: expected NUMBER got LONG BINARY . Just in case you think it: UTL_RAW.LENGTH raises ORA-00997: illegal use of LONG datatype :) (Yes, I know LONG RAW is deprecated - the question came up due to some old software that might require it) Vincent Malgrat I don't think it's possible to manipulate LONG RAWs longer than 32k in PLSQL. Here is a java procedure that returns the length of a LONG RAW. First,

How to average time intervals?

☆樱花仙子☆ 提交于 2019-11-27 02:46:20
问题 In Oracle 10g I have a table that holds timestamps showing how long certain operations took. It has two timestamp fields: starttime and endtime. I want to find averages of the durations given by these timestamps. I try: select avg(endtime-starttime) from timings; But get: SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got INTERVAL DAY TO SECOND This works: select avg(extract( second from endtime - starttime) + extract ( minute from endtime - starttime) * 60 + extract ( hour