1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

SQL Query Help

Discussion in 'SQL PL/SQL' started by jagadekara, May 15, 2014.

  1. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    Dear All,

    select 'Sample text' from dual;

    Ans:
    copy paste it in other place (ms word)
    it shows
    Sample text

    select 'Sample
    text' from dual;

    Ans:
    copy paste it in other place (ms word)

    "Sample
    text"

    Why it shows " ?

    I need just like below.

    Sample
    text
     
  2. rajenb

    rajenb Forum Expert

    Messages:
    361
    Likes Received:
    114
    Trophy Points:
    655
    Location:
    Mauritius
    Hi Jagadekara,

    Sorry, but can't reproduce it !
    Is it from some specific SQL environment to another, I mean from Windows SQL to UNIX SQL, TOAD, SQL Developer ... etc... ?

    Regards,
    Rajen
     
  3. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    Hi,

    I am using SQL Developer 11th version..
    I am using windows OS.

    I dpn't know it is happen in toad?
     
  4. rajenb

    rajenb Forum Expert

    Messages:
    361
    Likes Received:
    114
    Trophy Points:
    655
    Location:
    Mauritius
    Hi Jagadekara,

    This is a really strange behavior. I also did the same operations on SQL Developer (v3.2.20) but with different results:

    When copied from MS Word to SQL Developer:

    1)
    select 'Sample text' from dual;
    gives

    Sample text

    2)
    select 'Sample
    text' from dual;
    also gives

    Sample text

    However, on SQL over UNIX platform, the output of 2) is different:

    select 'Sample
    text' from dual;
    gives

    Sample
    text

    But in all cases, no "" is output.

    Hope it's not a "Preferences" set in SQL developer - but I don't think so.
    May be linked to how CR/LF from MS Word is "copied" or translated in SQL Developer environment during the "paste" operation.

    One among the mysteries of compatibility between products !

    Regards,
    Rajen.
     
  5. ocprep

    ocprep Forum Advisor

    Messages:
    277
    Likes Received:
    76
    Trophy Points:
    410
    Location:
    Orlando, Florida
    I don't know *why* the behavior is the way it is, but that is simply how SQL*Developer handles carriage returns, or line feeds (or both) in pasted text. I'm currently using 4.0.0.12, but I've seen it with other versions as well.

    Code (Text):
    SELECT 'Sample' || CHR(13) || CHR(10) || 'Text'
    FROM dual

    Pasted into MS Word:
    "Sample
    Text"
    ==========================================
    SELECT 'Sample' || CHR(13) || 'Text'
    FROM dual;

    Pasted into MS Word:
    "Sample Text"
    ==========================================
    SELECT 'Sample' || CHR(10) || 'Text'
    FROM dual;

    Pasted into MS Word:
    "Sample
    Text"
    ==========================================
    SELECT 'Sample Text'
    FROM dual;

    Pasted into MS Word:
    Sample Text
     
  6. suyash08

    suyash08 Active Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    75
    i thought oracle works on ascii and ms word have some other construct that's why its misbehave if we open it in vi it never be like that