帮助oracle程序 [英] Help in oracle procedure

查看:80
本文介绍了帮助oracle程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




请帮我调试以下程序。


SQL>创建或替换程序pr_test_new

2

3声明sql_stmt varchar2(100);

4开始

5 sql_stmt:=''select * from price'';

6立即执行sql_stmt;

7结束;

8 /


我正在使用oracle 8i


创建此程序时,我收到以下警告。


警告:程序用编译错误创建。


LINE / COL ERROR

-------- ------------- -------------------------------------------------- -

5/9 PLS-00103:遇到符号=当期待

之一时:

常数异常<一个标识符>

< a double-quoted delimited-identifier>表LONG_ double ref

char二进制国家字符nchar

符号< an identifier>用=代替继续。


6/19 PLS-00103:遇到符号SQL_STMT当期待以下一个

时:

:=。 (@%;非null范围重命名默认字符


请帮我解决上述问题。


提前致谢,

Chella

解决方案





请帮我调试以下程序。


SQL>创建或替换程序pr_test_new

2为

3声明sql_stmt varchar2(100);

4开始

5 sql_stmt:=''select * from price'';

6立即执行sql_stmt ;

7结束;

8 /

我使用的是oracle 8i


在创建此过程时,我收到以下警告。


警告:使用编译错误创建的过程。


LINE / COL ERROR
-------- ------------------------------------- ----------------------------

5/9 PLS-00103:遇到符号&quo t; ="当期待以下

之一时:

常数异常<一个标识符>

< a double-quoted delimited -identifier>表LONG_ double ref

char二进制国家字符nchar

符号< an identifier>用=代替继续。


6/19 PLS-00103:遇到符号SQL_STMT当期待以下一个

时:

:=。 (@%;非null范围重命名默认字符


请帮我解决上述问题。


提前致谢,

Chella



从代码中删除关键字DECLARE.DECLARE只能用于匿名块或触发器,而不能用于创建函数,程序


感谢您的回复。


但是当我尝试以下代码时,


声明sql_stmt varchar2(100);

begin

sql_stmt:=''select * from parts'';

执行立即sql_stmt ;

结束;


我收到以下错误。


第5行的错误:

ORA-06550:第5行第9列:

PLS-00103:当期待以下其中一个
时遇到符号IMMEDIATE:

:=。(@%;


请帮助我使这段代码工作。实际上问题出在哪里?


问候,

Chella



谢谢你回复。


但是当我尝试下面的代码时,


声明sql_stmt varchar2(100);

begin

sql_stmt:=''select * from parts'';

执行立即sql_stmt;

结束;


我收到以下错误。


第5行的错误:

ORA-06550:第5行第9列:

PLS-00103:遇到符号IMMEDIATE当期待

之一时:

:=。 (@%;


请帮助我使这段代码有效。实际上问题出在哪里?


问候,

Chella



你确定上面的代码是错误的吗?

这对我来说很好!!


Hi,

Please help me in debugging the below procedure.

SQL> create or replace procedure pr_test_new
2 as
3 declare sql_stmt varchar2(100);
4 begin
5 sql_stmt:=''select * from price'';
6 execute immediate sql_stmt;
7 end;
8 /

I am using oracle 8i

While creating this procedure I get the following warnings.

Warning: Procedure created with compilation errors.

LINE/COL ERROR
-------- -----------------------------------------------------------------
5/9 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char binary national character nchar
The symbol "<an identifier>" was substituted for "=" to continue.


6/19 PLS-00103: Encountered the symbol "SQL_STMT" when expecting one
of the following:
:= . ( @ % ; not null range renames default character


Please help me in solving the above problem.

Thanks in advance,
Chella

解决方案

Hi,

Please help me in debugging the below procedure.

SQL> create or replace procedure pr_test_new
2 as
3 declare sql_stmt varchar2(100);
4 begin
5 sql_stmt:=''select * from price'';
6 execute immediate sql_stmt;
7 end;
8 /

I am using oracle 8i

While creating this procedure I get the following warnings.

Warning: Procedure created with compilation errors.

LINE/COL ERROR
-------- -----------------------------------------------------------------
5/9 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char binary national character nchar
The symbol "<an identifier>" was substituted for "=" to continue.


6/19 PLS-00103: Encountered the symbol "SQL_STMT" when expecting one
of the following:
:= . ( @ % ; not null range renames default character


Please help me in solving the above problem.

Thanks in advance,
Chella

Remove the keyword "DECLARE" from your code. DECLARE should be used only in anonymous blocks or triggers and not while creating function,procedures


Thank you for the reply.

But when I tried the following code,

declare sql_stmt varchar2(100);
begin
sql_stmt:=''select * from parts'';
execute immediate sql_stmt;
end;

I get the following error.

ERROR at line 5:
ORA-06550: line 5, column 9:
PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the
following:
:= . ( @ % ;

Please help me to make this code work. Actually where could be the problem?

Regards,
Chella


Thank you for the reply.

But when I tried the following code,

declare sql_stmt varchar2(100);
begin
sql_stmt:=''select * from parts'';
execute immediate sql_stmt;
end;

I get the following error.

ERROR at line 5:
ORA-06550: line 5, column 9:
PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the
following:
:= . ( @ % ;

Please help me to make this code work. Actually where could be the problem?

Regards,
Chella

Are you sure the above code is erroring out?
It is working fine for me!!


这篇关于帮助oracle程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆