PL/SQL命令を分割しようとしています。私は次のパターンで来ました:
splitter_re = '(DECLARE.+?END;)\n+|;\n+'
そして、私は次のPL/SQLコードを持っています:
CREATE TABLE bk_temp1_kb AS
SELECT DISTINCT bk_c, bk_o, bk_r, bk_m
FROM www2013_02;
DECLARE
time_val NUMBER;
BEGIN
SELECT day INTO time_val
FROM days
WHERE day_desc = TO_CHAR(SYSDATE - 1);
EXECUTE IMMEDIATE
'DROP TABLE telep';
EXECUTE IMMEDIATE
'CREATE TABLE telep AS
SELECT cc,
dao,
a,
nam
FROM prodc
WHERE timer = ' || time_val;
END;
DROP TABLE kart;
CREATE TABLE kart AS
SELECT b.dwp
FROM t_prod_new b
WHERE b.task = 'CARD';
split() の結果は次のとおりです。
['CREATE TABLE bk_temp1_kb AS\nSELECT DISTINCT bk_c, bk_o, bk_r, bk_m\nFROM www2
013_02', None, '', "DECLARE\n time_val NUMBER;\nBEGIN\n SELECT day INTO time_v
al\n FROM days\n WHERE day_desc = TO_CHAR(SYSDATE - 1);\n \n EXECUTE IMMEDIAT
E\n 'DROP TABLE telep';\n \n EXECUTE IMMEDIATE\n 'CREATE TABLE telep AS\n SE
LECT cc,\n dao,\n a,\n nam \n FROM prodc\n WHERE timer =
' || time_val;\nEND;", 'DROP TABLE kart', None, "CREATE TABLE kart AS\nSELECT b
.dwp\nFROM t_prod_new b\nWHERE b.task = 'CARD';"]
それはとてもいいことですが、私には None 要素があります。パターンのどこが悪い?