473,657 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function took long time for execution..

13 New Member
Hi below function taking long time when i am going to execute this function.

CREATE OR REPLACE FUNCTION Getdistrictforu ser(PID IN WEBUSER.ID%TYPE )
RETURN VARCHAR2 IS
VCLUB VARCHAR(1000);

CURSOR CURSOROUT(PID VARCHAR2) IS
SELECT DISTINCT AD.DISTRICTID
FROM MEMBER M
JOIN CLUB C ON M.RCLBID = C.ID
AND M.RCLBIDTYPE = C.IDTYPE
AND M.MEMSTATCD IN (0, 51)
AND C.CLUBSTATCD < 21
JOIN ACTIVECLUBDIST AD ON AD.ID = C.ID
AND AD.IDTYPE = C.IDTYPE
AND M.ID = PID
JOIN ACTIVERIZONE AZ ON AD.DISTRICTID = AZ.DISTRICTID
AND C.CNTRYID = AZ.CNTRYID;
BEGIN
FOR REC_CUR IN CURSOROUT(PID) LOOP
IF VCLUB IS NULL THEN
VCLUB := REC_CUR.DISTRIC TID;
ELSE
VCLUB := VCLUB || ', ' || REC_CUR.DISTRIC TID;
END IF;
END LOOP;

RETURN VCLUB;
EXCEPTION
WHEN OTHERS THEN
BEGIN
DBMS_OUTPUT.PUT ('error');
END;
END GETDISTRICTFORU SER;

in the above SQL two views been used

1)ACTIVECLUBDIS T
2)ACTIVERIZONE

First view ACTIVECLUBDIST contains this sql

SELECT "ID","IDTYPE"," DISTRICTID","EF FDT","MODDT","M ODUSERID","ENDD T" FROM ClubDist
WHERE EffDt <= SYSDATE AND
(EndDt >= SYSDATE OR
EndDt IS NULL)and Second view ACTIVERIZONE contains this sql

SELECT cntryid,distric tid,rizoneid,re gionid,moddt,mo duserid,effdt,e nddt FROM Rizone
WHERE EffDt <= SYSDATE
AND(EndDt >= SYSDATE OR EndDt IS NULL).

because i am calling this function from one SQL so due to this its took long time.

so please request you that provide me better solution or modifie this function for better performance.

Regards,
Kiran
Feb 19 '10 #1
2 2465
OraMaster
135 New Member
You need to add RETURN in also exception section of your SP.
Feb 25 '10 #2
Madhusmita Biswal
6 New Member
Depending on how much data is in the tables, you may need to place indexes on the columns that are being joined against. Often slow querying speed comes down to lack of an index in the right place.

The issue mainly is in the multiple join statment. If possible try to avoid join

Read these article
Feb 26 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4950
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
9
2334
by: Sims | last post by:
Hi, I recall a function that would tell me how long it took to generate an output. But for the life of me I cannot remember it. Dow anybody know it? Or do I have to write something myself, (using time?). Sims
3
14928
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
15
11646
by: Steven T. Hatton | last post by:
Did I mess something along the way, or is there no function in Standard C++ to raise an (unsigned) int to a power of (unsigned) int returning (unsigned) int? I never gave this a second thought until today. I tried to do it, and discovered <cmath> std::pow() only takes floating point types for the first argument. Sure I could write one. I could have written at least 3 fundamentally differnet versions in the time it took to discover there...
39
6521
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
2
2624
by: tom horner | last post by:
Any ideas on why drop and create alias statements would take a long time? We recently went through an upgrade of our production database, which included alter statements to table structures, create tables, drop tables, and data inserts, deletes, and updates. Also, we dropped and recreated all the alias's we had on the tables and views to those tables. We are on UDB 7.2, FP7, on AIX. Everything took about the same time as in our...
2
7023
by: laurenq uantrell | last post by:
I have been using the following function to test the speed of various functions, however, quite often the return value is zero. I'm hoping someone can help improve on this. Function TimeIt() As Single On Error GoTo CodeErr 'PURPOSE: Times a process in seconds from start to finish 'USAGE: msgbox TimeIt Dim sngStart As Single
10
2177
by: Nitin | last post by:
Ppl , Want to have ur opinions on having function calls like the one stated below: function funcA ( struct A *st_A , struct B *st_B ) { st_A->a = st_B->a
12
1611
by: Crirus | last post by:
I need to measure how long a function take to execute... or a sequence of code within -- Ceers, Crirus ------------------------------ If work were a good thing, the boss would take it all from you
28
4305
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.