-
Replacing values
Hello,
How would I go about replacing values in all rows that contain value for example "INC" and replace it to "INC."
Example
"IBM INC" and replace it to "IBM INC."
Thanks
Roman
-
try some simple sql
update table_name set column_name = 'IBM INC.' where column_name = 'IBM INC';
-
That will not work, because we have about 20,000 unique company names and it would take me one week to do it one by one. But thanks for your suggestion.
Roman
-
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
I used the wildcard to identify all records with INC value. I do not know how to replace all found record with '%INC' to "INC."
----------------------
SELECT name
FROM company
WHERE name like '%INC'
-----------------------
Thanks
Roman
-
not predictable - what if there's a company called 'ZINC'? Use Replace and make sure you check for the space before the 'I' in 'INC'
-
Is there any way you can help me with the code.
Thanks
Roman
-
Not sure REPLACE will do what is wanted -
e.g. "INCREMENTAL CONFUSION INC" would end up as "INC.REMENTAL CONFUSION INC."
This might do:
UPDATE company SET name=name||'.'
WHERE name LIKE '%INC';
-
That worked great.
Thanks
Roman
-
Code:
SQL> create table test (company varchar2(20));
Table created.
SQL> insert into test values ('A1 Potatos Inc');
1 row created.
SQL> insert into test values ('Incorp Air Inc');
1 row created.
SQL> commit;
Commit complete.
SQL> select company from test;
COMPANY
--------------------
A1 Potatos Inc
Incorp Air Inc
SQL> select replace(company,' Inc',' Inc.') from test;
REPLACE(COMPANY,'INC','INC.')
------------------------------------------------------
A1 Potatos Inc.
Incorp Air Inc.
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|