473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help in oracle procedure

51
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
Oct 29 '07 #1
11 3064
amitpatel66
2,367 Expert 2GB
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
Oct 29 '07 #2
chella
51
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
Oct 29 '07 #3
amitpatel66
2,367 Expert 2GB
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!!
Oct 29 '07 #4
chella
51
Yes the above code gives me the error.

I am using oracle 8i. Hope that is not a problem.

Will 8i support 'execute immediate'?

Regards,
Chella
Oct 29 '07 #5
amitpatel66
2,367 Expert 2GB
Yes the above code gives me the error.

I am using oracle 8i. Hope that is not a problem.

Will 8i support 'execute immediate'?

Regards,
Chella
Yes oracle 8i supports Dynamic SQL.firstly I checked that only.
Are you executing this code from a file or directly in SQL PLUS??
Oct 29 '07 #6
chella
51
Yes oracle 8i supports Dynamic SQL.firstly I checked that only.
Are you executing this code from a file or directly in SQL PLUS??

I am directly executing the code in SQL plus.

Regards,
Chella
Oct 30 '07 #7
amitpatel66
2,367 Expert 2GB
I am directly executing the code in SQL plus.

Regards,
Chella
Just curious,
can you put the declaration sql_stmt in the next line and then check if it executes?
Oct 30 '07 #8
chella
51
Just curious,
can you put the declaration sql_stmt in the next line and then check if it executes?

I have tried that too...But still I have problem in executing the code.

I have a doubt here. Does the error mentioned in the above threads anyway mean that the oracle version which I am using doesn't support dynamic sql?

Regards,
Chella
Oct 30 '07 #9
amitpatel66
2,367 Expert 2GB
I have tried that too...But still I have problem in executing the code.

I have a doubt here. Does the error mentioned in the above threads anyway mean that the oracle version which I am using doesn't support dynamic sql?

Regards,
Chella
The problem is its not taking as EXECUTE IMMEDIATE.

Instead, it is taking just EXECUTE command which is basically used to execute any procedure,functions etc.

Eg: Both are same:

EXECUTE proc1(a,b,c);
EXEC proc1(a,b,c);
Oct 30 '07 #10
chella
51
The problem is its not taking as EXECUTE IMMEDIATE.

Instead, it is taking just EXECUTE command which is basically used to execute any procedure,functions etc.

Eg: Both are same:

EXECUTE proc1(a,b,c);
EXEC proc1(a,b,c);
I hope the problem is with my server.

Thank You vary much for the replies.

Regards,
Chella
Oct 31 '07 #11
amitpatel66
2,367 Expert 2GB
I hope the problem is with my server.

Thank You vary much for the replies.

Regards,
Chella

You are Welcome :)

Regards,
Amit
Oct 31 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

100
by: Peter | last post by:
Company thought DB2 will be better than Oracle. The bottom line is when you do select, the system crash. I think it may take 4-5 years for DB2 to reach Oracle standard. Peter
1
by: Jason Leiser | last post by:
Is there a way to call an Oracle Procedure using the MS OLD DB Provider for Oracle object in a SQL Server 2000 DTS package? If it can't be done this way, is there another way to retrieve data from...
0
by: totierne | last post by:
comp.databases.ms-access, I want to know how to use Oracle views with session variables in Access. The parameterised views in access, are migrated to views with per session variables. The...
4
by: Magy | last post by:
What would be the best way to execute a Oracle stored procedure that excepts several input paramters, through a web method in vb.net. What would be a good way to get to the web method, the Oracle...
1
by: burtonl | last post by:
I'm using the ADODB abstraction layer and trying to figure out how to call an Oracle stored procedure. It has the following types defined: CREATE OR REPLACE TYPE varchar2_3200_array IS TABLE...
0
by: TattedProgrammer | last post by:
Hello All, I am completely stuck, I have tried for an entire day to get a simple procedure call to my Oracle Db via the enterprise Library 06. I am not an oracle fan to start, but have to deal...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
3
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN...
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of Access 2003 (11.6566.8107) SP2, Oracle 9i 9.2.0.1.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.