Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dsnrexx character column with a quote (').

Status
Not open for further replies.

oregon999

Technical User
Sep 14, 2005
2
US
I have a table with a varchar column. Some row have quote (') and double quote (") as data. When I try to insert or update a row that has this I get a -104. I have tried to surrond the data with double quotes and three single quotes and still get the -104. Anyone know the anwser?
 
Should only be an issue if you are coding this data as a literal in your script. If it is already in a variable, for example if you've read it from a file or obtained it from a screen dialog, it shouldn't matter and you should be able to use it directly.
Code:
/* rexx */
quotedtext = '"oregon99''s quoting problem"';
say quotedtext;
The opening quote starts the literal; the rexx parser is now looking for a single quote to terminate it. The apostrophe (single quote) would normally do this, but because it is doubled it escapes the quote ('' is translated to ') and is treated as part of the string. The final quote terminates the string.

If you start the literal with " rather than ', then the same rules apply - if you have a " in the literal, you need to escape it with "".

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top