DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: qury -values in quotes

  1. #1
    Join Date
    Mar 2004
    Posts
    52

    query -values in quotes

    i want to dispaly the values of these columsn in single quotes.but it gives me an error.can some one help me what i am missing


    select
    "'"||column1||"'"
    ,"'"||column2||"'"
    ,"'"||column3||"'"
    ,"'"||column4||"'"
    ,"'"||column5||"'"
    ,"'"||column6||"'"
    ,"'"||column7||"'"
    ,"'"||column8/90||"'"
    ,"'"||column9/65||"'"
    from table1;

    when i execute I get the following error
    ,"'"||column9/65||"'"
    *
    ERROR at line 10:
    ORA-00904: "'": invalid identifier
    Last edited by RamanaSQL; 12-23-2004 at 01:26 PM.

  2. #2
    Join Date
    Feb 2001
    Posts
    295
    Code:
    select 
    ''''||column1||''''
    ,''''||column2||''''
    ,''''||column3||''''
    ,''''||column4||'''' 
    ,''''||column5||'''' 
    ,''''||column6||'''' 
    ,''''||column7||''''
    ,''''||column8/90||'''' 
    ,''''||column9/65||'''' 
    from table1;
    An ounce of action is worth a ton of theory.
    —Friedrich Engels

  3. #3
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    String literals must go between single-quotes. If you want a single-quote to be part of a string it must be entered TWICE. So you need 4 single-quotes in a row to represent a string consisting of one single-quote.

  4. #4
    Join Date
    Mar 2004
    Posts
    52
    thanks for the reply.One more question ,

    how do i remove the space between the columns

    currently it displays like this

    'value1'...........,'value2'............,

    instead i would like to display
    'value1','value2','value3'

    pls let me know

    thanks
    vg
    Last edited by RamanaSQL; 12-23-2004 at 01:27 PM.

  5. #5
    Join Date
    Feb 2001
    Posts
    295
    Originally posted by RamanaSQL
    thanks for the reply.One more question ,

    how do i remove the space between the columns

    currently it displays like this

    'value1'...........,'value2'............,

    instead i would like to display
    'value1','value2','value3'

    pls let me know

    thanks
    vg

    RTRIM/LTRIM ?

    COLUMN [colname] FORMAT a[length] on SQL*Plus?
    An ounce of action is worth a ton of theory.
    —Friedrich Engels

  6. #6
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Like:
    Code:
    select ''''||value1||''','''||value2||''''
    If I've counted correctly

Posting Permissions

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


Click Here to Expand Forum to Full Width