Oracle syntax highlighting for alternative quoted strings

Oracle syntax highlighting for alternative quoted strings

7
NewbieNewbie
7

    Dec 12, 2011#1

    Oracle provides a "quoted string" syntax. For example, a string could be

    'Some String' or q'{Some String}'

    This is described in detail at http://docs.oracle.com/cd/E11882_01/ser ... SQLRF00218 ; the "{}" can be any of a number of pairs. (In fact, it can be any single character though [, {, <, or ( all require the corresponding close brace.)

    This is particularly handy for doing quotes within quotes:

    'that''s my boy' can be expressed without the double-single-quote as q'{that's my boy}'

    But, seems that the available wordfiles don't quite handle this condition...and if you start doing quoted strings within quoted strings:

    q'[ this is a q'{quoted string}' within a quoted string]'

    I don't know if/how to make it handle this...

    Thoughts?
    Thanks,
    :-Phil

    6,681583
    Grand MasterGrand Master
    6,681583

      Dec 12, 2011#2

      UltraEdit supports only 2 types of string highlighting.

      The most common string type requires highlighting a sequence of characters usually defined by a single or double quote character at begin and end as string with an escape character (different to the string definition character) for defining the single/double/escape character inside the string. Such a string definition is also supported by Oracle as I read on the referenced page. With String Chars = ' in the wordfile this type of strings in Oracle files is supported perfect by UltraEdit.

      The second supported type is specific to C#. Strings with a string literal prefix as described on the UltraEdit help page with title Syntax Highlighting. This type of string highlighting is of no help for highlighting Oracle strings using alternative quoting mechanism.

      What you can do is to use the alternative block comment highlighting feature to highlight exactly 1 type of alternative quoted Oracle strings. When you use for example Block Comment On Alt = q'{ Block Comment Off Alt = }' additionally to String Chars = ' on the first line of the wordfile used to highlight Orcale files, you would get simple single quoted strings highlighted with the color defined for color group Strings and strings defined by q'{ and }' with the color defined for color group Alternate Block Comments. Of course you can use the same color for both color groups.

      But more is not possible with UE v17.30.0.1011. Support for highlighting strings q'[any character or opening brace] and [same character as opening character or matching closing brace]' is definitely not possible. I suggest to simply use twice the single quote to escape a single quote inside a string instead of the alternative quote mechanism. I'm not editing Orcale files, but I think it is easier to simple hit twice the key for inserting a single quote to define a single quote inside a string instead of going to start of string, insert there q and after the single quote a second character and insert at end before closing single quote the matching character.

      7
      NewbieNewbie
      7

        Dec 12, 2011#3

        Thanks. The reason (in Oracle) I want to use quoted strings is to facilitate copy-paste between my stored procedures and a straight SQL command prompt is due to the fact that I'm using PL/SQL to dynamically construct SQL statements. It becomes mind-numbing to try to track down the meaning of ''''', it's a little bit a question of "how hard to create" but a lot more a question of "how hard to read" :)

        The "Alt" works well for a single level.

        I'd be happy if I could give a list of open/close sequences, for example q'{ }' and q'[ ]'. Having one (via the Alt mechanism) certainly helps.

        Thanks,
        :-Phil