Solved

using ||  in casewhen

Posted on 2013-02-04
2
317 Views
Last Modified: 2013-02-04
hi guys
I have two tables

employee table has
Id salary   bonus
1  100       22
2  300        33
5  600

customer table has
Id salary  bonus
1   100     33
2   500      44
5   800

select e.id, case when e.salary != c.salary || e.bonus != c.bonus then 'false' else 'true' end status

getting error
ORA-00905: missing keyword
00905. 00000 -  "missing keyword"

any idea?

thanks
0
Comment
Question by:royjayd
2 Comments
 
LVL 11

Accepted Solution

by:
SANDY_SK earned 350 total points
ID: 38852290
have you tried using OR instead of ||

select e.id, case when e.salary != c.salary OR e.bonus != c.bonus then 'false' else 'true' end status
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 50 total points
ID: 38852309
>>select e.id, case when e.salary != c.salary || e.bonus != c.bonus then 'false' else 'true' end status


'||' is a string concatination.  I think you want 'or' here.

select e.id, case when e.salary != c.salary or e.bonus != c.bonus then 'false' else 'true' end status
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to take different types of Oracle backups using RMAN.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now