473,398 Members | 2,165 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,398 software developers and data experts.

Missing Parenthese Error: ORA-00907

Anyone see anything wrong with this:
create or replace function HourParser(DayTimeValue In Integer) return
varchar2 is
Result varchar2(20);
begin
Execute Immediate
'SELECT CASE (WHEN :x > 1) THEN "YES" END
FROM DUAL' Into Result Using DayTimeValue;

Return(result);
end HourParser;

Jul 19 '05 #1
3 9959
Terry Coccoli wrote:
Anyone see anything wrong with this:
create or replace function HourParser(DayTimeValue In Integer) return
varchar2 is
Result varchar2(20);
begin
Execute Immediate
'SELECT CASE (WHEN :x > 1) THEN "YES" END
FROM DUAL' Into Result Using DayTimeValue;

Return(result);
end HourParser;

I fixed this one. The double quotes were replaced by consecutive single
quotes, and for a reason unknown to me, I had to remove the parentheses.

But I have another question now. I expanded on the above CASE statement
so that I now reference :x 10 times. It seems that the USING clause has
to look something like

USING DayTimeValue, DayTimeValue, DayTimeValue....,DayTimeValue (10th
iteration) or else I get an 'ORA-01008:not all bind variables bound' error.

Is there any way to simplify the Using clause for a situation where I
need to continually reference the bind variable ?

Jul 19 '05 #2
Terry Coccoli <re*****@ifneeded.com> wrote in message news:<Kr**********************@news.easynews.com>. ..
Terry Coccoli wrote:
Anyone see anything wrong with this:
create or replace function HourParser(DayTimeValue In Integer) return
varchar2 is
Result varchar2(20);
begin
Execute Immediate
'SELECT CASE (WHEN :x > 1) THEN "YES" END
FROM DUAL' Into Result Using DayTimeValue;

Return(result);
end HourParser;

I fixed this one. The double quotes were replaced by consecutive single
quotes, and for a reason unknown to me, I had to remove the parentheses.

But I have another question now. I expanded on the above CASE statement
so that I now reference :x 10 times. It seems that the USING clause has
to look something like

USING DayTimeValue, DayTimeValue, DayTimeValue....,DayTimeValue (10th
iteration) or else I get an 'ORA-01008:not all bind variables bound' error.

Is there any way to simplify the Using clause for a situation where I
need to continually reference the bind variable ?


Sure, you can, but it would require you to stop misusing dynamic sql,
and *Learn* Pl/sql, instead of just hacking away.
Actually you don't need it all for this statement, and an ordinary
select into will just do fine. In that case you can refer directly to
DayTimeValue.
Note: EXECUTE IMMEDIATE statements are always parsed. Using dynamic
sql everywhere is the safest method to get awful performance. Seems
you, without extensive reading and understanding the PL/SQL
documentation, you are heading directly into a disaster.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #3
sy******@yahoo.com wrote:
Terry Coccoli <re*****@ifneeded.com> wrote in message news:<Kr**********************@news.easynews.com>. ..
Terry Coccoli wrote:

Anyone see anything wrong with this:
create or replace function HourParser(DayTimeValue In Integer) return
varchar2 is
Result varchar2(20);
begin
Execute Immediate
'SELECT CASE (WHEN :x > 1) THEN "YES" END
FROM DUAL' Into Result Using DayTimeValue;

Return(result);
end HourParser;

I fixed this one. The double quotes were replaced by consecutive single
quotes, and for a reason unknown to me, I had to remove the parentheses.

But I have another question now. I expanded on the above CASE statement
so that I now reference :x 10 times. It seems that the USING clause has
to look something like

USING DayTimeValue, DayTimeValue, DayTimeValue....,DayTimeValue (10th
iteration) or else I get an 'ORA-01008:not all bind variables bound' error.

Is there any way to simplify the Using clause for a situation where I
need to continually reference the bind variable ?

Sure, you can, but it would require you to stop misusing dynamic sql,
and *Learn* Pl/sql, instead of just hacking away.
Actually you don't need it all for this statement, and an ordinary
select into will just do fine. In that case you can refer directly to
DayTimeValue.
Note: EXECUTE IMMEDIATE statements are always parsed. Using dynamic
sql everywhere is the safest method to get awful performance. Seems
you, without extensive reading and understanding the PL/SQL
documentation, you are heading directly into a disaster.

Sybrand Bakker
Senior Oracle DBA


Sy, it's always interesting to read your posts first thing in the
morning. I would definitely like to learn PL/SQL and I'm hoping that
you or someone else can point me in the right direction in this case.

I'm using dynamic SQL in this example because I'm on an 8.1.7 environ
and the query makes use of the CASE statement, which the PL/SQL parser
doesn't recognize.

How would you suggest that I do this in PL/ SQL ?

Thanks.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: NotNeo | last post by:
I am getting a strange symptom: tnsping and sqlplus work fine on my LINUX server (neo) so the listener and DB are OK. However, from my remote XP Client (tank) I get TNS-12560. I can ping the neo...
1
by: Galina | last post by:
Hello I have created a trigger not to let records with certain fields null to be inserted into the table: BEGIN IF :new.RUL_CODE is null or :new.FES_UINS_CODE is null or :new.FES_UIO_CALOCC is...
1
by: Park Yeon Jo | last post by:
About Error : ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor I installed Oracle 8.1.7 on Windows XP Professional. and I wanto connect to that server...
3
by: Thomas Gagné | last post by:
I've never installed Oracle, and have just worked my way through getting 9i installed on RedHat 9. When I try to start it up I get the following: $ sqlplus /nolog SQL*Plus: Release...
8
by: CJM | last post by:
I have a working web application (ASP) which links to an Oracle 10g DB via OO4O. I'm trying to port it to either of two test servers, but in fact, I can't get it to work with either - 'Unable to...
1
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the...
0
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the...
1
by: hoonig | last post by:
I have this traditional error "ORA-12560:TNS:Protocol Adapter Error" when trying to connect to my Oracle 8i databases on Netware (i.e when i load svrmgr31, plus81, etc...) Listener seems to work...
2
by: devas | last post by:
Hai, Issue: I am using OEM 10g grid control. I want to establish the connection from oracle to sql server=>I can’t able to connect it. Please help me I have created the system dsn below steps....
0
by: wolfee | last post by:
I'm running 10gR2 RAC in Prod, Test and DEV and after doing a clone to the DEV environment I'm getting a wierd ORA-12514 error for only one node. I can tnsping the node and it comes back fine. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.