Query formation

Posted on 2012-03-11
Last Modified: 2012-06-21

Please check the attached function, can I bring this function and the attached query in single
Select statement.

Query file attached calling function, and it is taking so much time, any suggestions or forming this whole thing into a single query would be helpful.

Please help.

Question by:neoarwin
  • 2
LVL 20

Accepted Solution

flow01 earned 500 total points
ID: 37707747
as far as i can see most information is already in your query

try replacing
volumesituation(iv.acct_nr,iv.ord_id,iv.cmpgn_nr,iv.cmpgn_yr,iv.vol_nr) AS situacao


WHEN  (tkg.point_trkg_cd not in (23,30) AND  iv.devltn_drft_nr is null) THEN
      WHEN  (select count(1)  from sir_sbmsn_acct b
               where  iv.cmpgn_nr = b.cmpgn_nr
                  AND iva.cmpgn_yr = b.cmpgn_yr
                  AND iva.acct_nr = b.acct_nr
                  AND iv.ord_id  = b.ord_id
                  AND b.SBMSN_ACCT_TYP in(4,13)) > 0) THEN 'volume não escaneado no transportador'
      'volume duplicado'
      WHEN (tkg.point_trkg_cd in (23,30)  AND  tkg.point_trkg_cd =25) THEN 'volume não recebido no CD (trânsito)'
END  AS situacao

Author Comment

ID: 37712506
Thank you very much I will try this :)

Author Closing Comment

ID: 37762748
It never worked out by that way, but you did a good try and I appreciate that, thank you very much.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL Convert to PL/SQL 23 77
Deny Oracle DBAs from Connecting  "/ as sysdba" 5 52
history tablespace temp usage 2 31
oracle 11g 23 48
Article by: Swadhin
From the Oracle SQL Reference ( we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

912 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

22 Experts available now in Live!

Get 1:1 Help Now