Solved

using ||  in casewhen

Posted on 2013-02-04
2
323 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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…

777 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