473,729 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help in oracle procedure

51 New Member
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:='sele ct * 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 3094
amitpatel66
2,367 Recognized Expert Top Contributor
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:='sele ct * 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,proced ures
Oct 29 '07 #2
chella
51 New Member
Thank you for the reply.

But when I tried the following code,

declare sql_stmt varchar2(100);
begin
sql_stmt:='sele ct * 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 Recognized Expert Top Contributor
Thank you for the reply.

But when I tried the following code,

declare sql_stmt varchar2(100);
begin
sql_stmt:='sele ct * 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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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,funct ions etc.

Eg: Both are same:

EXECUTE proc1(a,b,c);
EXEC proc1(a,b,c);
Oct 30 '07 #10

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

Similar topics

100
9085
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
6190
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 an Oracle database using an Oracle procedure to a SQL Server table? Also, can parameters be passed into Oracle from SQL Server via a procedure? Our Oracle DBA does NOT want to create views to enable SQL Server to access the data. Examples...
0
3025
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 open questions: How to display a resultset
4
2347
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 stored procedure's definition; the name of the proc. and all of the parameter information such as name, value, type and value. I'm looking for the best method. Any ideas. Magy
1
3454
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 OF VARCHAR2(3200); / CREATE OR REPLACE TYPE number_array IS TABLE OF NUMBER; /
0
1403
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 with it for now. I am only trying to retrieve data into a dataset from the oracle procedure, nothing fancy! Here is my 100th version of code I have.
14
4593
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 nothing seems to work. What data type must I return for this to be accepted as .NET stored procedure?
3
4171
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 { $ENV{'TNS_ADMIN'} = '/auto/engweb/oracle/sqlnet'; $ENV{'ORACLE_HOME'} = '/usr/packages/dbdoracle/9.2.0'; }
23
3423
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 and ODBC 3.525.1117.0, on Windows XP Pro 5.1.2600 SP2 Nu 2600. I failed executing an Oracle stored procedure from Access, and a trigger to store data to a temporary table was active from SQL*Plus, but
0
8917
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.