RE: Format instead of execute
Michael Staszewski <[email protected]>
| Newsgroups | gmane.comp.db.oracle.toad.free |
|---|---|
| Message-ID | <6548C9485A5E9C41AE3BB626E669B547102926DD@ALVMBXW01.prod.quest.corp> |
A new feature was added that supports execution of SQL embedded within PL/SQL. The Edit SQL dialog is to display the SQL as Toad understands it to give you a chance to modify it before execution. 11.0 exhibits the behavior you describe where the Edit SQL dialog displays every time the feature is invoked. This has been fixed for 11.5 to only show the dialog when the SQL has been modified. The only option for you in this case is to upgrade.
In case you've not seen the feature, paste the following into the Editor and either select the SQL statement or just place caret within it and use CTRL+Enter. It will not create the procedure, it will execute the SQL stripping out PL/SQL specific identifiers. This is a bad example, but you'll see how the INTO clause is removed and PL/SQL identifiers are converted into binds.
CREATE OR REPLACE PROCEDURE test_proc (p1 IN NUMBER)
AS
n NUMBER;
BEGIN
SELECT COUNT (*)
INTO n
FROM user_objects
WHERE object_id < p1;
END;
Michael
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of John Graves
Sent: Tuesday, May 08, 2012 2:12 PM
To: [email protected]
Subject: [toad] Format instead of execute
Maybe someone can suggest what is going on here. In the editor I have this:
CURSOR c1 IS SELECT dummy FROM dual;
If I highlight SELECT through ; or SELECT through dual and press F9, I
get the expected output.
If I go up two lines and put in a DECLARE, so it looks like this:
DECLARE
CURSOR c1 IS SELECT dummy FROM dual;
and I highlight the same SELECT through ; or SELECT through dual and
press F9, I get en Edit SQL window that reads:
/* Formatted on 5/8/2012 1:02:55 PM (QP5 v5.185.11230.41888) */
SELECT dummy FROM DUAL;
I'm on TOAD 11.0.0.116 as I haven't had a chance to get the latest
loaded up yet. I often highlight and run the SQL in a cursor before
execution to see the result set as a last sanity check before
execution. I've done this many, many times, but lately I get the Edit
SQL window instead of execution and a result set. Any idea why? Have I
changed some setting in the options by accident or something?
John
------------------------------------
Yahoo! Groups Links
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/toad/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/toad/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/