473,387 Members | 1,798 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,387 software developers and data experts.

ORA-00907: missing right parenthesis

Expand|Select|Wrap|Line Numbers
  1. select * from test where sal in ( case sal
  2. when (sal < 5000)  and (sal > 2000) then 2000
  3. else 3000
  4. end)
  5.  
  6. SQL> /
  7. when (sal<5000  and sal>2000) then 2000
  8.          *
  9. ERROR at line 2:
  10. ORA-00907: missing right parenthesis
  11.  
  12.  
if i executing this stmt , i m getting an error message
Sep 28 '07 #1
5 6438
Hi,

Try belwo one it will work for you.

Expand|Select|Wrap|Line Numbers
  1. select * from emp where sal=(case when sal>2000 and sal<5000 then 2000 else 3000 end)
  2.  
Let know if you face any issues.
Nov 22 '07 #2
amitpatel66
2,367 Expert 2GB
All,

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Nov 22 '07 #3
amitpatel66
2,367 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. select * from test where sal in ( case sal
  2. when (sal < 5000)  and (sal > 2000) then 2000
  3. else 3000
  4. end)
  5.  
  6. SQL> /
  7. when (sal<5000  and sal>2000) then 2000
  8.          *
  9. ERROR at line 2:
  10. ORA-00907: missing right parenthesis
  11.  
  12.  
if i executing this stmt , i m getting an error message
The error is because you have used column name "sal" twice in your CASE, one immediately after "CASE" keyword and then again with WHEN sal <.

Try this:
Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from test where sal in (case when (sal < 5000)  and (sal > 2000) then 2000
  3. else 3000
  4. end)
  5.  
  6.  
Nov 22 '07 #4
amitpatel66
2,367 Expert 2GB
Hi,

Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR
Nov 22 '07 #5
QVeen72
1,445 Expert 1GB
Hi,

You cant write a "Case" statement in Where Condition when you are using a "Select" Query....

Try This :
Expand|Select|Wrap|Line Numbers
  1. Select T.* , ( case when (sal < 5000)  and (sal > 2000) then 2000
  2. else 3000 end) from test T
  3.  
Regards
Veena
Nov 23 '07 #6

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

Similar topics

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...
1
by: Adam Ruth | last post by:
I'm using OCI on Mac OS X and I've run into a strange problem with my TNSNAMES.ORA file. My TNSNAMES.ORA file has one entry INV4II and it works fine. However, it will only work if that is the...
6
by: bdj | last post by:
Hello! I have at set of tnsnames.ora. I wich to make an union, e.g. a single file of it. How can I do that easy? Greetings Bjørn
4
by: Tig | last post by:
Hi all. I have a need to connect to an Oracle 7.3.3.5 database. I have a user who successfully connects to it with her Oracle 7.3 client. I have an Oracle 9.2 client installed on my machine. ...
2
by: mpatel6 | last post by:
I had this error in alert log and my instance was down, anybody can help me? Errors in file /u01/app/oracle/admin/sotstest/bdump/sotstest_p004_626740.trc: ORA-07445: exception encountered: core...
5
by: mivey4 | last post by:
Hi, First off, I am aware that this is a very heavily documented error and I have done my homework for throughly researching probable causes before deciding to post my problem here. At this point,...
0
by: basmgokul | last post by:
I am using oracle 10g in windows vista.. when starting DB it throws an error Errors in file c:\database\udump\practice_ora_440.trc: ORA-00704: bootstrap process failure ORA-39700: database...
1
by: michael ngong | last post by:
michael.john@gmx.at (Michael John) wrote in message news:<90cc4edd.0306230900.28075193@posting.google.com>... MIchael I you stated the OS and platform that could make it easier to address your...
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...
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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,...

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.