0 Comments

I had to go through quite many Oracle scripts last week and one of them was giving the following error:

PLS-00103: Encountered the symbol “CREATE”

As it turns out, if you’re creating a trigger in your Oracle script, you have to include the ‘/’ character after it or you will get this error. Here’s an example of a broken script:

<span style="color: #606060" id="lnum1">   1:</span> CREATE OR REPLACE TRIGGER MY_TRIGGER

<span style="color: #606060" id="lnum2">   2:</span> AFTER UPDATE OF DATA ON TABLE FOR EACH ROW

<span style="color: #606060" id="lnum3">   3:</span> BEGIN

<span style="color: #606060" id="lnum4">   4:</span>     UPDATE TABLE SET DATA=<span style="color: #006080">'Changed data'</span>

<span style="color: #606060" id="lnum5">   5:</span> END;

<span style="color: #606060" id="lnum6">   6:</span>  

<span style="color: #606060" id="lnum7">   7:</span> CREATE VIEW MYDATA_VIEW AS...

But fixing this just requires one new character

<span style="color: #606060" id="lnum1">   1:</span> CREATE OR REPLACE TRIGGER MY_TRIGGER

<span style="color: #606060" id="lnum2">   2:</span> AFTER UPDATE OF DATA ON TABLE FOR EACH ROW

<span style="color: #606060" id="lnum3">   3:</span> BEGIN

<span style="color: #606060" id="lnum4">   4:</span>     UPDATE TABLE SET DATA=<span style="color: #006080">'Changed data'</span>

<span style="color: #606060" id="lnum5">   5:</span> END;

<span style="color: #606060" id="lnum6">   6:</span> /

<span style="color: #606060" id="lnum7">   7:</span> CREATE VIEW MYDATA_VIEW AS...