如何连接两列的值并将连接值插入另一个表的一列

时间:2013-12-30 06:12:39

标签: plsql procedure

表: SOURCE (Label,SerialNo )

行数:

a 1
b 2
c 3

目标表:目标(Concat)

预期行

1a
2b
3c

这需要通过程序来实现。

1 个答案:

答案 0 :(得分:0)

    Hi this procedure should satisfy your query.Please let me know if you want anything else. Thanks


    CREATE OR REPLACE
PROCEDURE query_answered
AS
BEGIN
  FOR rec IN
  ( SELECT sr_no||' '||name AS combined_value FROM avrajit
  )
  LOOP
    INSERT INTO av_dup
      (department
      ) VALUES
      (rec.combined_value
      );
    COMMIT;
  END LOOP;
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line('Error captured'||' '||sqlerrm);
END query_answered;

    ----------------------------------
    OUTPUT
    ----------------------------------


    BEGIN
      query_answered();
    END;