Solved

compre toata in where clue oracle

Posted on 2016-11-03
4
62 Views
Last Modified: 2016-11-04
hi am geting this error in this query invalid identifie
select itemN0, item_in_qty - nvl(qty_out,0)qty from employee,dept  
where employee.deptid = dept.deptid  
and qty > dept_qty --how can i compare the  

Open in new window

0
Comment
Question by:chalie001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 51

Assisted Solution

by:Ryan Chong
Ryan Chong earned 250 total points
ID: 41873488
try:

select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
where employee.deptid = dept.deptid  
and item_in_qty - nvl(qty_out,0) > dept_qty

Open in new window

0
 
LVL 28

Accepted Solution

by:
Pawan Kumar earned 250 total points
ID: 41873491
Try..

select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
where employee.deptid = dept.deptid  
and (  item_in_qty - nvl(qty_out,0) )  > dept_qty

Open in new window


Try 2..


SELECT * FROM
(
	select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
	where employee.deptid = dept.deptid  
)
WHERE qty > dept_qty

Open in new window

0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 41873557
I just wanted to mentioned that it is giving an error because it could not refer to the column alias qty in the where clause which you have used in the select.

As mentioned, you need to use the expression itself in the where clause or use an inline view query.

Thanks,
0
 

Author Closing Comment

by:chalie001
ID: 41873560
correct solution
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL GROUP BY 6 80
looking for guidance on Oracle Sql Formatting standards 9 30
Database-Scoped Permissions 2 17
Estimating my database size 7 17
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

726 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