Skip to Main Content

SQLcl

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Can't create alias that has a comment with an odd amount of quotes in it (23.4 & 14.1)

Erik van RoonApr 16 2024 — edited Apr 16 2024

Just noticed that in version 23.4 and now 24.1, aliases that have comments in their implementation which contain a quote (rather: that overall have an odd amount of quotes, including the ones in the comments) can not be created anymore.
It worked until version 23.3.
The creation fails with a syntax error being reported.

Such aliases that have been created in earlier versions are loaded into the new version without a problem.
So, if it's already in the aliases.xml file, or if you hack it into that file manually, it works.
But if you (re)create the (modified?) alias it won't work without making sure the number of quotes is even, including the ones in the comments.

Demo:

In version 23.3 (when it still worked):

version

Check if the alias exists, and if so show its definition

alias list testquote

It doesn't, so let's create it.
Notice the quote inside the comment.

alias testquote=select /* don't use quotes here */ 'It worked' from dual;

No feedback, hence no error messages. Check if the alias exists now….

alias list testquote

Yes! It's there. But, does it work?

testquote

And yes it also works without any problems. \o/

In version 23.4 and 24.1 (when it doesn't work anymore):

version

Check if the alias exists, and if so show its definition

alias details testquote

It doesn't, so let's create it.
Notice the quote inside the comment.

alias testquote=select /* don't use quotes here */ 'It worked' from dual;

Wow! Syntax error! (Plus the long text of the help for alias)

alias details testquote

unsurprisingly the alias has not been created.

What if we avoid using a quote in the comment?

alias testquote=select /* do not use quotes here */ 'It worked' from dual;

This version of the alias is created. (And we get feedback! Great improvement!

Check the alias

alias details testquote

Looks good. Does it work?

testquote

Yes.

Comments
Post Details
Added on Apr 16 2024
0 comments
61 views