Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2016
    Posts
    3

    Unanswered: single quotes embedded in string

    I need to populate a field via a dynamic SQL statement. I want my field to contain 'A'. Not A .... but 'A'. How do I embed the single quotes inside the sql string? The following does not work, and errors with -104 - invalid token. Assume the below variable is 10 positions long.

    PARMVALUE = ''A'<><><><><><><><><><>'

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Parmvalue = '''А'''
    Regards,
    Mark.

  3. #3
    Join Date
    Jun 2016
    Posts
    3

    single quotes embedded in string

    Quote Originally Posted by mark.b View Post
    Parmvalue = '''А'''
    Are you implying to replace the inside single quotes with double quotes? I am certain I tried this and it wouldn't work ..... as far as I recollect it wouldn't even compile. I am coding in RPG Free. I need to populate a file / field with 'A' (including the single quotes). In using a dynamic sql statement the string needs to be surrounded by single quotes. Any other thoughts would be much appreciated. Thank you kindly for your reply.

  4. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    I haven't ever used RPG.
    If you have an ability to run the following via any tool which can use dynamic sql, then run it and show us the result:
    Code:
    declare global temporary table session.a (c varchar(10)) with replace on commit preserve rows not logged;
    insert into session.a values ('''A''');
    select * from session.a;
    Regards,
    Mark.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •