Solved

I want to write a query to populate column values based on another column

Posted on 2016-11-08
1
48 Views
Last Modified: 2016-11-08
Example :

If table has two columns

S.No     Hostname        URL

1           abc                    
2           efg
3           hij
4           klmn

the result after query execution should be:

S.No     Hostname        URL

1           abc                    http://abc.xyz.com
2           efg                     http://efg.xyz.com
3           hij                      http://hij.xyz.com
4           klmn                 http://klmn.xyz.com


Please help me with an oracle statement.

something like

update table set url='http://<correspondinghostname>.xyz.com'

Any help would be highly appreciated.

Thanks for you help!

Best Regards
Devsupport
0
Comment
Question by:DevSupport
1 Comment
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 41879185
update table set url='http://' || hostname || '.xyz.com'
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now