Is there a way to perform an SQL Syntax check prior to execution?

Hello,

I am a very new user of TOAD (V9.0.1.8).

I was wondering if there is a way to check SQL syntax prior to executing/running SQL statements in the Editor? I used to use iSeries Navigator with DB2 and there was a handy SQL Syntax check built in. Perhaps TOAD has this capability and I just have not found it. I appreciate any information that can be provided.

Thanks…

Try the formatter. It should pick up most syntax issues.

It may however pick up things the formatter doesn’t like vs what the
Oracle engine won’t like.

Hi William,

I was wondering if there is a way to check SQL syntax prior
to executing/running SQL statements in the Editor?

CTRL+E will cause the statement to be parsed and explained. If your
syntax is broken, the parse will fail as will the subsequent explain
plan.

HTH

Cheers,
Norm. [TeamT]

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

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

William,

There are several things you can try:

A: Run the explain plan. If you statement fails to generate an explain plan, it
will fail to run. This might help you in tuning as well.

B: Format the code. The formatter is checking for keywords, comma, semi-colons,
parenthesis, etc. If you statement fails to format…

C: For SELECT statements use the “Parse Select Statement” option
from the editor pulldown menu

If it’s a select stmt, you can CTRL+F9 on it. Not sure about other stmt
types off the top of my head, but there is probably something.

Oh, that’s a goodie I completely forgot about!

The responses to this question give clear evidence as which of us are keyboard
focused (adroit use of shortcut keys) and which of us are screen focused (deft
handling of pulldown menus, right mouse menus and toolbar buttons).

Hi Patrick,

The responses to this question give clear evidence as which of us are
keyboard focused (adroit use of shortcut keys) and which of us are
screen focused (deft handling of pulldown menus, right mouse menus and
toolbar buttons).

Not necessarily! :wink:

I may have said, for example, "use CTRL+E to get an explain plan" simply
because I am pretty lazy at times and it is easier than trying to
explain to someone who might have a different Toad GUI set up to the one
I use, where to find the "ambulance" button - and indeed, to describe
what an ambulance looks like - given that different countries may use
different vehicles as ambulances.

Equally, I still don't quite understand what the relevance of an
ambulance is to explain plan!

Failing the above, taking a screen dump of the GUI, cropping out
everything except the ambulance button and pasting that into the email
is equally as "difficult".

Nah, nothing to do with keyboard guru at all, I'm lazy!!! :wink:

In truth, sometimes I GUI, sometimes I keyboard. I alost never use a
right-click->edit->copy or paste when I can CTRL_C and CTRL+V but other
things I use the menu, I almost never CTRL+X for Cut. Strange!

Cheers,
Norm. [TeamT]

Norm,

Thanks for the short keys. I find them more productive than using the mouse. Both are good, depending upon ones needs …

John