Toad World® Forums

TOAD doesn't like FOR statement?

SEE ATTACHMENT

It's not that it doesn't like it. Well it kind of doesn't like it. That's the
new Code Analysis feature. If you mouse over the blue squiggles, it'll show you
what rule has been violated. Also, if you right click on the blue squiggles,
you'll see a menu item or Rule Violations and you can get a detailed explanation
of what it doesn't like. The blue squiggles don’t affect the ability to
compile but do show you some possible issues in the "best practices"
world.

Greg

(squiggle dumb).

Also you might like to replace the select distinct (bad practice) with a
subquery using exists or not exists – which generally (although version
dependent) perform better – i.e. better plans

SEE ATTACHMENT
att1.dat (13.6 KB)

We don't have a "ignore this rule" or "ignore this instance"
feature yet…yet. That sounds like a good one for the Idea Pond!

I had to turn it off. It became too annoying especially during the development
phase when things are generally a mess. When I'm all done coding, I
use Code Analyzer. Also, many of the rules are problematic. For example:

  c_aff_key_username_nomatch     CONSTANT PLS_INTEGER := -20013;

  aff_key_username_nomatch                EXCEPTION;

  PRAGMA EXCEPTION_INIT (aff_key_username_nomatch, -20013);

It tells me that aff_key_username_nomatch is not referenced when it is
referenced in the very next line.

Still, it DOES catch problems, so I do use it while wishing it was smarter. :slight_smile:

Mike

On Mon, Oct 10, 2011 at 1:18 PM, Gregory Liss wrote:

We don't have a "ignore this rule" or "ignore this
instance" feature yet…yet.   That sounds like a good one for the
Idea Pond!

Wendy,

An alternative is to define a custom rule set where the "FOR" rule is not
included, and select that as your default rule set in the editor.

I guess the apple didn't fall far from the tree in the smarts department. We're
both learning and hopefully we'll get some of the rules promoted into the 6th
grade during the beta cycle.

Greg - squiggle (feeling really) dumb

Morning Bert,

Also you might like to replace the select distinct (bad
practice) with a subquery using exists or not exists - which
generally (although version dependent) perform better - i.e.
better plans
I was thinking about the SELECT DISTINCT as well. Mainly because there is no chance that there will be a data set containing any owner.table_name.column_name that would be duplicated, regardless of the comments.

Mind you, I always think about the SELECT DISTINCTs when I see them. I spent 18 months trying to educate a third party who simply used SELECT DISTINCT every time - but in the form:

SELECT DISTINCT (Something), something_else, ...

thinking - if I can use the word, that only the SOMETHING column would be distinct! :frowning:

Cheers,
Norm. [TeamT]

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Build Team
Internal : 7 28 2051
External : 0113 231 2051

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

On Oct 11, 2011, at 2:57 AM, “Dunbar, Norman (Capgemini)” wrote:

Morning Bert,

Also you might like to replace the select distinct (bad
practice) with a subquery using exists or not exists - which
generally (although version dependent) perform better - i.e.
better plans
I was thinking about the SELECT DISTINCT as well. Mainly because there is no chance that there will be a data set containing any owner.table_name.column_name that would be duplicated, regardless of the comments.

Mind you, I always think about the SELECT DISTINCTs when I see them. I spent 18 months trying to educate a third party who simply used SELECT DISTINCT every time - but in the form:

SELECT DISTINCT (Something), something_else, …

thinking - if I can use the word, that only the SOMETHING column would be distinct! :frowning:

Cheers,
Norm. [TeamT]

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Build Team
Internal : 7 28 2051
External : 0113 231 2051

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Yes, I checked and the sql statement returns the same number of rows regardless
of whether DISTINCT is used, so I removed it.

On 10/11/2011 2:57 AM, Dunbar, Norman (Capgemini) wrote:

Morning Bert,

>> Also you might like to replace the select distinct (bad
>> practice) with a subquery using exists or not exists - which
>> generally (although version dependent) perform better - i.e.
>> better plans
I was thinking about the SELECT DISTINCT as well. Mainly because there is no
chance that there will be a data set containing any
owner.table_name.column_name that would be duplicated, regardless of the
comments.

Mind you, I always think about the SELECT DISTINCTs when I see them. I spent
18 months trying to educate a third party who simply used SELECT DISTINCT
every time - but in the form:

SELECT DISTINCT (Something), something_else, ...

thinking - if I can use the word, that only the SOMETHING column would be
distinct! :-(

Cheers,
Norm. [TeamT]

Norman Dunbar
Contract Senior Oracle DBA
Capgemini Database Build Team
Internal : 7 28 2051
External : 0113 231 2051

Information in this message may be confidential and may be legally
privileged. If you have received this message by mistake, please notify the
sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should
still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to
under the Freedom of Information Act, Data Protection Act or for litigation.
Email messages and attachments sent to or from any Environment Agency
address may also be accessed by someone other than the sender or recipient,
for business purposes.

If we have sent you information and you wish to use it please read our terms
and conditions which you can get by calling us on 08708 506 506. Find out
more about the Environment Agency at www.environment-agency.gov.uk