• <bdo id='ia0L1'></bdo><ul id='ia0L1'></ul>

    1. <legend id='ia0L1'><style id='ia0L1'><dir id='ia0L1'><q id='ia0L1'></q></dir></style></legend>

      1. <i id='ia0L1'><tr id='ia0L1'><dt id='ia0L1'><q id='ia0L1'><span id='ia0L1'><b id='ia0L1'><form id='ia0L1'><ins id='ia0L1'></ins><ul id='ia0L1'></ul><sub id='ia0L1'></sub></form><legend id='ia0L1'></legend><bdo id='ia0L1'><pre id='ia0L1'><center id='ia0L1'></center></pre></bdo></b><th id='ia0L1'></th></span></q></dt></tr></i><div id='ia0L1'><tfoot id='ia0L1'></tfoot><dl id='ia0L1'><fieldset id='ia0L1'></fieldset></dl></div>
      2. <small id='ia0L1'></small><noframes id='ia0L1'>

      3. <tfoot id='ia0L1'></tfoot>

        创建oracle包遇到PLS-00103:遇到符号“CREATE";

        时间:2023-11-03
        <legend id='Pzbe9'><style id='Pzbe9'><dir id='Pzbe9'><q id='Pzbe9'></q></dir></style></legend>

            <tbody id='Pzbe9'></tbody>
            <bdo id='Pzbe9'></bdo><ul id='Pzbe9'></ul>

            1. <small id='Pzbe9'></small><noframes id='Pzbe9'>

              • <i id='Pzbe9'><tr id='Pzbe9'><dt id='Pzbe9'><q id='Pzbe9'><span id='Pzbe9'><b id='Pzbe9'><form id='Pzbe9'><ins id='Pzbe9'></ins><ul id='Pzbe9'></ul><sub id='Pzbe9'></sub></form><legend id='Pzbe9'></legend><bdo id='Pzbe9'><pre id='Pzbe9'><center id='Pzbe9'></center></pre></bdo></b><th id='Pzbe9'></th></span></q></dt></tr></i><div id='Pzbe9'><tfoot id='Pzbe9'></tfoot><dl id='Pzbe9'><fieldset id='Pzbe9'></fieldset></dl></div>
                • <tfoot id='Pzbe9'></tfoot>
                  本文介绍了创建oracle包遇到PLS-00103:遇到符号“CREATE";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Oracle sql developer 编写一个 oracle 包,我收到了这个编译错误:

                  I am writing an oracle package using Oracle sql developer, I got this compile error:

                  错误(7,1):PLS-00103:遇到符号CREATE".

                  Error(7,1): PLS-00103: Encountered the symbol "CREATE" .

                  create or replace
                  PACKAGE TestPackage AS 
                   FUNCTION beforePopulate RETURN BOOLEAN;
                   FUNCTION afterPopulate RETURN BOOLEAN;
                  END TestPackage;
                  
                  CREATE OR REPLACE PACKAGE BODY TestPackage AS
                     FUNCTION beforePopulate RETURN BOOLEAN AS
                     BEGIN
                        DELETE FROM TEST_1;
                        INSERT INTO TEST_1
                        SELECT * FROM TEST WHERE VALUE=300;
                        COMMIT;
                        RETURN TRUE;
                       EXCEPTION
                         WHEN OTHERS THEN
                          RETURN FALSE;
                     END;
                     FUNCTION afterPopulate RETURN BOOLEAN AS
                       BEGIN
                           UPDATE TEST SET RESULT="completed" WHERE VALUE=300;
                              COMMIT;
                           RETURN TRUE;
                           EXCEPTION
                             WHEN OTHERS RETURN FALSE;
                          END;
                    END;
                  END TestPackage;
                  

                  如果我在第 6 行添加 /,错误变成:

                  If I add a / at line 6, the error became:

                  错误(6,1):PLS-00103:遇到符号/"

                  Error(6,1): PLS-00103: Encountered the symbol "/"

                  我厌倦了这样一个空的实现:

                  I tired an empty implementation like this:

                  create or replace 
                  package package1 as 
                  END PACKAGE1;
                  
                  CREATE OR REPLACE 
                  package body package1 as 
                  end package1;
                  

                  我也犯了同样的错误.

                  推荐答案

                  当你有 BEGIN、END 等时,你是在 PL/SQL,而不是 SQL.

                  When you have BEGIN, END, etc you are in PL/SQL, not SQL.

                  PL/SQL 块需要在行的最开始用一个(正向")斜线终止.这告诉 Oracle 您已经完成了 PL/SQL 块,因此它会编译该文本块.

                  A PL/SQL block needs to be terminated with a single ("forward") slash at the very beginning of the line. This tells Oracle that you are done with your PL/SQL block, so it compiles that block of text.

                  SQL 查询 - 以分号终止:

                  SQL query - terminated by semicolon:

                  update orders set status = 'COMPLETE' where order_id = 55255;
                  

                  PL/SQL 块 - 命令以分号分隔,块以正斜杠终止:

                  PL/SQL block - commands separated by semicolon, block is terminated by forward-slash:

                  create or replace procedure mark_order_complete (completed_order_id in number)
                  is
                  begin
                       update orders set status = 'COMPLETE' where order_id = :completed_order_id;
                  end mark_order_complete;
                  /
                  

                  这篇关于创建oracle包遇到PLS-00103:遇到符号“CREATE";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何像在 T-SQL 中一样在 PL/SQL 中声明和使用变量? 下一篇:ORA-00947 全局声明类型时值不足

                  相关文章

                • <tfoot id='VNnWX'></tfoot>
                • <legend id='VNnWX'><style id='VNnWX'><dir id='VNnWX'><q id='VNnWX'></q></dir></style></legend>
                  <i id='VNnWX'><tr id='VNnWX'><dt id='VNnWX'><q id='VNnWX'><span id='VNnWX'><b id='VNnWX'><form id='VNnWX'><ins id='VNnWX'></ins><ul id='VNnWX'></ul><sub id='VNnWX'></sub></form><legend id='VNnWX'></legend><bdo id='VNnWX'><pre id='VNnWX'><center id='VNnWX'></center></pre></bdo></b><th id='VNnWX'></th></span></q></dt></tr></i><div id='VNnWX'><tfoot id='VNnWX'></tfoot><dl id='VNnWX'><fieldset id='VNnWX'></fieldset></dl></div>
                    <bdo id='VNnWX'></bdo><ul id='VNnWX'></ul>

                    1. <small id='VNnWX'></small><noframes id='VNnWX'>