Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    4

    Unanswered: use single quote ascii value for display strings?

    Hi i have small doubt

    1. when we want to display string we display like this

    select 'HI' from dual;
    instead of single quote (apostrophe) before and after HI can i use ASCII value of single quote

    like select 39HI39 from dual;

    anypossibility is there for using ascii value instead of single quote.

    Thanking you.
    Regards,
    Ramana.
    Last edited by ramana554; 09-30-09 at 07:21.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    7879

    Sorry, I mean "NO"!

    But I'm curious: what problem are you trying to overcome? If we understand that we may be able to suggest a different approach that will work. If it is that you are trying to write dynamic SQL with quotes in, do this:

    v_sql := 'select ''HI'' from dual';

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Well, sure, you can use ASCII values - you'd concatenate them with the rest of the string:
    Code:
    SQL> select chr(39) ||'hello'|| chr(39) result from dual;
    
    RESULT
    -------
    'hello'
    However, you can not omit apostrophes:
    Code:
    SQL> select chr(39) ||hello|| chr(39) result from dual;
    select chr(39) ||hello|| chr(39) result from dual
                     *
    ERROR at line 1:
    ORA-00904: "HELLO": invalid identifier
    So, what is the problem, anyway?

Posting Permissions

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