v_sql := 'delete user' || tableid1 || ' t1'||
' where t1.delflag = 0'||
' and exists(select * from user' || tableid2 || ' t2'||
' where t2.phone = t1.phone and t2.field1 > t1.field1 and rownum < 2)';
t2.field1 > t1.field1 这里存的字符串时间。
我现在要把它们当作时间来比较大小。
有没有什么办法在这个v_sql里通过拼接实现
哪位知道。帮个忙。。
不好意思。没积分了。
[code="java"]' where t2.phone = t1.phone and to_date('|| t2.field1||',''yyyy-mm-dd hh24:mi:ss'') > to_date('|| t1.field1||',''yyyy-mm-dd hh24:mi:ss'') and rownum < 2)'; [/code]
to_date( t2.field1,'yyyy-mm-dd hh24:mi:ss') > to_date( t1.field1,'yyyy-mm-dd hh24:mi:ss')
都是字符串,就直接当字符串比较好了