Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

No rows returned in subquery

Posted on 2003-11-24
4
Medium Priority
?
963 Views
Last Modified: 2010-05-18
I have the following query in a PL/SQL block:

select nvl(include_in_dif, 1)
   into m_include_in_dif
  from pcc
 where pcc in (select nvl(pcc, 'NONE')
                 from gdls_z_expanded_boms
                where bomtype = 'MRP'
                  and partnum = 'DIFREPORT-001');

The Sub query returns no rows so the whole query returns nothing. I would like m_include_in_dif to default to '1' if no rows are returned. The above query does not do this of course.

Can I do this in one query. Any ideas ... ?

Romans
0
Comment
Question by:Romans
[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
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:FBIAGENT
ID: 9813141
have you try this?

select nvl(include_in_dif, 1)
   into m_include_in_dif
  from pcc
 where pcc in (select max(nvl(pcc, 'NONE'))
                 from gdls_z_expanded_boms
                where bomtype = 'MRP'
                  and partnum = 'DIFREPORT-001')
;

0
 

Author Comment

by:Romans
ID: 9813646
This ones not work FBIAGENT .... thanks for the input

Romans
0
 
LVL 5

Accepted Solution

by:
FBIAGENT earned 200 total points
ID: 9813822
this should work

have you try this?

select nvl(max(include_in_dif), 1)
   into m_include_in_dif
  from pcc
 where pcc in (select nvl(max(pcc), 'NONE'))
                 from gdls_z_expanded_boms
                where bomtype = 'MRP'
                  and partnum = 'DIFREPORT-001')
;
0
 

Author Comment

by:Romans
ID: 9814685
This one works ....

Thanks FBIAGENT

Romans
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

618 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