You need to escape the single quotation mark with more single quotation marks.
select '''c:\file_name''' from wherever;
The string 'c:\file_name' needs to be quoted differently than a string without any single ticks on it - confusing, but that's how it works. You can also use chr(39) to represent the single tick.
To create a single quote, concatenate CHR(39) to the string.
Example 1
---------
SQL> SELECT 'test' || CHR(39) || 'case' result
2> FROM dual;
RESULT
---------
test'case
Example 2
---------
SQL> SELECT CHR(39) FROM dual;
C
-
'
Keep the following two rules in mind:
1. Enclose every character string in single quotes.
The single quote is a string delimiter.
2. Inside a string literal, use two consecutive single quotes
to create a literal single quote.
Example 1
---------
6 single quotes: 'test' || '''''' || 'case' ---> test''case
8 single quotes: 'test' || '''''''' || 'case' ---> test'''case
You can also implement the above in the following way:
Bookmarks