Weird behavior with non-standard characters

I noticed that (using toad 16.2.98.1741) I can not execute the following (with F9):

--๐Ÿ˜€
SELECT 1 FROM DUAL;

I get the error ORA-00942: table or view does not exist, if I add a comment like this it works fine:

--๐Ÿ˜€
SELECT 1 FROM DUAL
--๐Ÿ˜€
;

There seems to be some kind of weird processing going on because in the first case the SQL that actually gets executed by toad (Spool SQL) is:

SELECT 1 FROM DUA;

This statement:
SELECT '๐Ÿ˜€' FROM DUAL;
causes the same issue but then the following SQL is also executed for some reason

select length(substrb('SELECT ''๐Ÿ˜€'' FROM DUA
', 1, 19)) CHAR_OFFSET from dual

This is a known issue and needs to be documented in the release notes. I will log a task to document it. There is no fix at the moment because of a difference between lengths and offsets returned by the parser and how Toad calculates string lengths. The parser and Toad are written in different languages. Both are correct for their respective language, but they are unfortunately calculated differently thus Toad truncates what is sent to Oracle.

1 Like

I forgot to add that there are a few workarounds. You can execute statements with emoji using Execute Script (F5) or you can select the statement and then use F9.