0

问题:我正在尝试检查表中是否已经存在记录。对于此检查,我使用两列 id 和 isAlive。

Insert into table1 (id,name,isAlive)
  Select t2.id, 
         t2.name, 
         null as isAlive
    From table2 t2
   Where Not exist ( select 1 
                       from table1 t1 
                      where t1.id=t2.id
                        and t1.column2 is null )

Table1 Data:
{id,name,isAlive}
{123,'Test','Y'}
{234,'Test1',null}

Table2 Data:
{id,name}
{123,'Test'}
{234,'Test1'}
{456,'Test2'}

当我尝试在表 t1 中插入 456 时,我的 sql 失败并出现以下错误

ORA-01722: invalid number
01722. 00000 -  "invalid number"
*Cause:    
*Action:
4

1 回答 1

0

one of the column was varchar and I was comparing it with number Thanks. Resolved

于 2013-10-23T08:36:05.240 回答