Skip to content

Commit fb6b0ad

Browse files
committed
Fix trigger export with duplicate FOR EACH clause when a REFERENCING clause is present. Thanks to Carens Kurniawan Wijaya for the report.
1 parent f950ded commit fb6b0ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Ora2Pg.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5806,9 +5806,9 @@ sub export_trigger
58065806
$reftb =~ s/NEW TABLE AS Inserted // if ($trig->[2] eq 'DELETE');
58075807
$sql_output .= "$reftb FOR EACH STATEMENT\n";
58085808
} elsif ($statement) {
5809-
$sql_output .= "FOR EACH STATEMENT\n";
5809+
$sql_output .= "FOR EACH STATEMENT\n" if ($sql_output !~ /FOR EACH STATEMENT/);
58105810
} else {
5811-
$sql_output .= "FOR EACH ROW\n";
5811+
$sql_output .= "FOR EACH ROW\n" if ($sql_output !~ /FOR EACH ROW/);
58125812
}
58135813
$sql_output .= "\tEXECUTE PROCEDURE $trig_fctname();\n\n";
58145814
}

0 commit comments

Comments
 (0)