+ -
当前位置:首页 → 问答吧 → help!对表中所有字符型字段自动去除双引号

help!对表中所有字符型字段自动去除双引号

时间:2011-09-24

来源:互联网

因为VF里导出TAB分隔符的TXT,然后通过SQLLOADER导入ORACLE里,所有字符型字段均会自动加上引号,
导入ORACLE后需将双引号去除,代码如下,但是在第16行报错,帮忙看下。以下这段代码是在PL/SQL
里运行的:
DECLARE
    CURSOR   cur   IS
        select   column_name   from   USER_TAB_COLUMNS   where   lower(table_name)= 'gzyhfx '   and   data_type= 'VARCHAR2 ';
    V_COUNTER   NUMBER;
    v_count   number;
BEGIN
V_COUNTER   :=   0;
v_count:=0;
execute   immediate   'truncate   table   hbh_3g_promotion_count ';
commit;
insert   into   hbh_3g_promotion_count(col1,col2)   VALUES( '统计开始 ',sysdate);
update   hbh_3g_promotion_count   set   zs=(select   count(*)   from   USER_TAB_COLUMNS   where   (table_name)= 'GZYHFX '   and   data_type= 'VARCHAR2 ');
commit;
    FOR   row   IN   cur   LOOP

        update   gzyhfx   set   row.column_name=replace(row.column_name, ' " ', ' ');
        commit;
          V_COUNTER   :=   V_COUNTER   +   1;
      v_count:=v_count+1;
      update   hbh_3g_promotion_count   set   js=v_count;--计算更新的条数
          commit;
    END   LOOP;
      update   hbh_3g_promotion_count   set   col3=sysdate;
      update   hbh_3g_promotion_count   set   time=ROUND(TO_NUMBER(col3   -   col2)   *   24   *   60   *   60);--计算程序运行秒数
    commit;
END;

作者: hbh107708   发布时间: 2011-09-24

ora-06550: line 16,column 39:
pl/sql:ora-00904: : invalid identifier
ora-06550,column 5:
pl/sql:sql statement ignored

作者: hbh107708   发布时间: 2011-09-24

热门下载

更多