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
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
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to recover a database from a user managed backup
Suggested Courses

617 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