Results 1 to 4 of 4

Thread: Select Query

  1. #1
    Join Date
    Mar 2012
    Posts
    37

    Unanswered: Select Query

    Hello All,

    I am using the select query as below
    Select country from table1 which give the output as
    COUNTRY
    US
    USA
    UK
    Malaysia
    France
    Europe
    US
    USA

    I want to change whenever US comes it change to USA. So the output should be as below-:

    COUNTRY
    USA
    USA
    UK
    Malaysia
    France
    Europe
    USA
    USA

  2. #2
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Quote Originally Posted by goodman2253 View Post
    I am using the select query as below
    Select country from table1

    I want to change whenever US comes it change to USA. So the output should be as below-:

    COUNTRY
    USA
    USA
    UK
    Malaysia
    France
    Europe
    USA
    USA
    How about

    Code:
    Select Case when country = 'US' then 'USA' else country end 
      from table1
    or as alternative, execute the following query once and you don't have to worry about what the Select statement returns.

    Code:
    Update Table1 SET
       Country = 'USA'
    Where Country = 'US'
    Note: None of this code is tested. Please test before using.

  3. #3
    Join Date
    Mar 2012
    Posts
    37
    any function like regexp_replace. Because using case make the sql query execute very slow. For one case its fine, but If I have to use multiple then. I hope you understand my point

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    ... using case make the sql query execute very slow. ...
    Is it true? I doubt that.

    From where did you go the information?

    ... For one case its fine, but If I have to use multiple then.
    Another point might be that the CASE expressin provided by LinksUp was not multiple cases.
    The CASE expressin contains only one case.
    Last edited by tonkuma; 09-08-13 at 16:21.

Posting Permissions

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