通过从另一个选择全部插入到 table 中,当语句为真时更改 PL/SQL 中的值

Insert into table by selecting all from another and when a statement is true change the value in PL/SQL

所以我想做的是将 table(所有这些)的值插入 它们变成一个新的,当它遇到任何值时,文章标识符 (sa.art_ident) 将其替换为单词 bighead,并将 sa.art_moddate 替换为当前系统时间。每当我尝试 运行 它告诉我缺少右括号...请帮助

PROCEDURE p_copier_one IS

     BEGIN
    INSERT INTO article_new
      (
        SELECT * FROM article_old sa
          CASE 
            WHEN sa.art_ident='%' THEN
            sa.art_ident = 'Bighead'
          END
        CASE
          WHEN sa.art_moddate='%' THEN
          sa.art_moddate = to_date(
                           '02/04/2012' 
                           ,'DD/MM/YYYY')
                           ,trunc(SYSDATE)

         END
          );



END p_copier_one;

欢迎来到 SO。您需要执行如下所示的操作。在线阅读我的评论。

CREATE OR REPLACE PROCEDURE p_copier_one
IS
BEGIN
  ---List down all your columns here. Although its option to mention your table column but its good practise. 
    INSERT INTO article_new (
        col1,
        col2,
        col3,
        col4,
        col5
    )
        SELECT col1,
               col2,
               --Put your case here
               CASE
                WHEN sa.art_ident = '%' THEN 'Bighead'
               END   col3,
               CASE
                WHEN sa.art_moddate = '%' THEN TO_DATE('02/04/2012','DD/MM/YYYY')
               END   col4,
               trunc(SYSDATE) col5
        FROM article_old sa;
COMMIT;        
END;