从另一个程序编译和执行过程

时间:2016-12-03 12:24:51

标签: sql oracle plsql

我已经为程序编写了如下基本测试代码

create or replace procedure getDetails
AS
output_detail varchar2(30);
detail_you_need varchar2(30);
name_of_player varchar2(30);

BEGIN

select &detail_you_need into output_detail from players where name ='&name_of_player';
dbms_output.put_line(UPPER(output_detail));

END;
/

我试图从另一个程序编译并执行它,如下所示

create or replace procedure getPlayerInfo
as
BEGIN

set serveroutput on;
dbms_output.put_line('Enter the name of the info and the player you want to know the detail of, when prompted...');

@getDetails.sql;
execute getDetails;

END;
/

单独编写代码并准确执行,但是从getPlayerInfo执行此操作时会出现如下错误

SQL> show errors
Errors for PROCEDURE GETPLAYERINFO:

LINE/COL ERROR
5/1      PL/SQL: SQL Statement ignored
5/5      PL/SQL: ORA-00922: missing or invalid option
8/1      PLS-00103: Encountered the symbol "CREATE" when expecting one of
     the following:
     ( begin case declare end exception exit for goto if loop mod
     null pragma raise return select update while with
     <an identifier> <a double-quoted delimited-identifier>
     <a bind variable> << continue close current delete fetch lock
     insert open rollback savepoint set sql execute commit forall
     merge pipe purge

我该如何解决这个问题?

0 个答案:

没有答案