?
Solved

No rows returned in subquery

Posted on 2003-11-24
4
Medium Priority
?
961 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

762 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