I agree to Idea Highlight related INTO or VALUES text to enable easy matching
Voting Disabled

68 votes

I disagree to Idea Highlight related INTO or VALUES text to enable easy matching

Rank7

Idea#285

This idea is active.
Editor »

Highlight related INTO or VALUES text to enable easy matching

It would be very cool if TOAD would highlight matching INTO or VALUES text. For instance, if I have the following PLSQL:

select 'this_value', 'that_value'

into this_param, that_param

from dual

when the cursor is on THAT_VALUE it would also highlight THAT_PARAM. This would make it really easy to match up INTO values or VALUES in a INSERT INTO statement (I'm thinking for examples which are much bigger than my simple example).

I'd also like it to highlight the entire block of code if the value is determined by a block of code i.e. a CASE statement.

Or maybe a hover over that displays the text. Lots of possibilities.

Submitted by Richard Squires 3 years ago

Comments (5)

  1. This sounds similar to an idea I just entered (without realising this existed) whereby the corresponding aliases in a view defintion and the selected columns are highlighted.

    3 years ago
    0 Agreed
    0 Disagreed
  2. Moderator

    Would it be acceptable that this would only work on well-formed statements? For example, your example SQL is complete, but what about the following example?

    select 'this_value', // Nothing is here for second item

    into this_param, that_param

    from dual

    In this example the second item in the select list is not defined, but the ',' has been entered. Ideally it should know that you are about to enter a value to be assigned to that_param, but is it a show-stopper is this example does not work?

    I've looked into what it would take to implement this and I think that it's fairly straightforward if we assume syntactically correct SQL. Our parser is very intelligent and can overcome a lot in terms of syntax errors, but when a statement has one it parses as much as possible and then stops. In my example the parser would not return information about this_param or that_param so the Editor would not be able to highlight those values. In your example it would be fairly simple.

    2 years ago
    1 Agreed
    0 Disagreed
  3. Personally I'd have thought that would be fine as long as it still works when there is a mismatch between the number of values in the SELECT clause and the number of variables.

    This functionality would be really helpful in working out where that mismatch is.

    2 years ago
    2 Agreed
    0 Disagreed
  4. Dcondo,

    Mismatches between SELECT list and variable list counts are flagged as a warning, but they don't stop parsing. So yes that would work.

    2 years ago
    1 Agreed
    0 Disagreed
  5. Richard Squires Idea Submitter

    I never really considered the parser checking the code as I typed, I was more interested in "well formed" PLSQL ie. when I'm viewing a package in the SB Packages RHS or the Describe window. Would be useful in the SQL Editor as well though and I think it's more than sufficient to assume the code is well formed in order for this feature to work.

    2 years ago
    0 Agreed
    0 Disagreed