Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004
    Posts
    35

    Unanswered: replacing single quote

    i need to read data from a file.
    how do i find if there is a ' in the line?
    i cannot do like
    if strA like ''' then
    ....

    but if i put
    if strA like '''' then
    .....

    there is no compilation error but i don't think it works as when i read it is '

    eg of data read : Hi I'm mary.

    how to solve this problem?

  2. #2
    Join Date
    Jan 2003
    Posts
    106

    whats the problem

    Using UTL_FILE package you can read from file having single quote,that shouldnt be a problem.
    Sachi

  3. #3
    Join Date
    Nov 2004
    Posts
    35
    but i need to insert it into oracle. and it is not allowed.

  4. #4
    Join Date
    Jan 2003
    Posts
    106

    check

    Hi,

    DECLARE
    D VARCHAR2(100);
    BEGIN
    <ASSUME variable D has the string fetched from the file>
    <You can simply give like this,it will work>
    INSERT INTO TEST VALUES(D)

    END;
    Sachi

  5. #5
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    Any of these
    Code:
    SQL@8i> select 1 from dual where 'hello this '' is an apostrophe' like '%''%';
    
             1
    ----------
             1
    
    SQL@8i> select 1 from dual where instr('hello this '' is an apostrophe', '''' ) > 0;
    
             1
    ----------
             1
    
    SQL@8i> select 1 from dual where instr( replace( 'hello this '' is an apostrophe', '''', '#' ),'#' ) > 0;
    
             1
    ----------
             1
    .. could work I guess.

Posting Permissions

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