Home » SQL & PL/SQL » SQL & PL/SQL » Is there a more efficient way to do this?
Is there a more efficient way to do this? [message #188713] Mon, 21 August 2006 05:10 Go to next message
Tom Dunne
Messages: 13
Registered: August 2006
Location: Dublin, Ireland
Junior Member
Hi All,

I have a procedure in a package defined as follows:
PROCEDURE getDetails( A in x.code%type, 
                      B in x.code%type,
                      
                      C in y.dis_code%type,
                      D in y.dis_code%type,
                      E in y.dis_code%type,
                      MyCursor OUT curMemberDetails) AS <snip>

As you can see, A and B are two possible values for x.code , C,D and E are three possible values for y.dis_code.

Further down in a where clause, I have the following
... and (j.code=A or j.code=B)
and k.code in (C,D,E)

I am just wondering if there is a more efficient way of doing this?

If not, that's great.

Thanks,

TD.

[Updated on: Mon, 21 August 2006 05:19]

Report message to a moderator

Re: Is there a more efficient way to do this? [message #188780 is a reply to message #188713] Mon, 21 August 2006 12:00 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If A/B/C/D/E are always NOT NULL values, then that query looks fine.
Re: Is there a more efficient way to do this? [message #188783 is a reply to message #188780] Mon, 21 August 2006 12:59 Go to previous messageGo to next message
Tom Dunne
Messages: 13
Registered: August 2006
Location: Dublin, Ireland
Junior Member
You see, that's the thing.

The front end is a web page and the options are check boxes, so potentially they could be null.

Re: Is there a more efficient way to do this? [message #188797 is a reply to message #188783] Mon, 21 August 2006 13:54 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Well, the NULLs would only be a problem if both A and B were null, or if C/D/E were all null. If you'll have at least one not null value in each group you should be alright.
Re: Is there a more efficient way to do this? [message #188859 is a reply to message #188797] Tue, 22 August 2006 03:27 Go to previous message
Tom Dunne
Messages: 13
Registered: August 2006
Location: Dublin, Ireland
Junior Member
Just thinking about the application, at least one tick box in each group should be ticked, so I should be ok. It doesn't make sense that the end user would not select at least one from each.

Thanks for your help.

Previous Topic: Bind Variables
Next Topic: SQL Report using 2 groupings with label
Goto Forum:
  


Current Time: Sun Dec 04 18:56:18 CST 2016

Total time taken to generate the page: 0.04573 seconds