not exists子句给出无效数字错误

时间:2013-10-22 17:10:43

标签: sql oracle

问题:我正在尝试检查表中是否已有记录。对于此检查,我使用两列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:

1 个答案:

答案 0 :(得分:0)

其中一列是varchar,我将它与数字进行比较 谢谢。解决