QUOTE a PL/SQL String (q'# #' )

Dani

Member
Hello,

I have problem with Syntaxdetection and Syntaxhighlighting of PL/SQL Developer.The PL/SQL Developer don't recognize the String-Definition with q'#String#'.

String example with q'#String#'.

Code:
DECLARE
   string varchar2(10);
BEGIN
   string := q'#I'm a String.#';
END;

String example without q'#String#'.

Code:
DECLARE
   string varchar2(10);
BEGIN
   string := 'I''m a String.';
END;

Do anybody known a Solution for this problem?
Maybe a setting for PL/SQL-Developer.

Daniel
 
17116_900.png

Hi! Long living thread :)

There are issues with these q-strings.
There're generally two of them:
- only different kinds of brackets are accepted, while Oracle specification allows any symbol to be used, like q'# #' in the subject.
- brackets are not checked to match each other: you can start string with a parenthesis ( and end with a square bracket ]

I face this behaviour in 11.0.0 but in recent changelog I didn't find anything about q-strings highlighting.
 
Last edited:
This is indeed a restriction/bug in the syntax highlighting. As you have noticed, only "", "[]", "{}" and "()" pairs are highlighted, and incorrectly mixed pairs are highlighted.
 
Hello,

Also in Version 12 (and 11), we have an issue with the q-string (containing brackets) and syntax-highlighting:

PL/SQL:
-------
begin
l_sql := q'[ UPDATE mytable SET col1 = {col1}, col4 = '{col4}' col5 = '{col5}' WHERE myId = {{myId}} ]';
end;

SQL:
-----
select q'[ UPDATE mytable SET col1 = {col1}, col4 = '{col4}' col5 = '{col5}' WHERE myId = {{myId}} ]' from dual;

 
Very much a workaround, but I add a comment w/ a single quote at end of line and the formatting comes about:

Code:
DECLARE
   string varchar2(10);
BEGIN
   string := q'#I'm a String.#'; -- '
END;
 
Last edited:
Back
Top