Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

I need an update statement

Posted on 2012-04-05
7
Medium Priority
?
346 Views
Last Modified: 2012-06-09
Hello Experts,

I've the following select statement in a column:

select
      to_char(column1), to_number( Null ), credavlby, tenor, tenordays,
      to_char(column2)
from
      Test

I need this select statement to be as the following by using an update statement:

select
      replace(to_char(column1),''__'',chr(10)),
      to_number( Null ), credavlby, tenor, tenordays,
      replace(to_char(column2),''__'',chr(10))
from
      Test


I need to replace     "to_char"     with     "replace(to_char"
        And keep "column1"     and     "column2"     as it is,
        The value for coulmn1 and column2     is Changeable not a fixed value
        Then after "(column1)"     add     ",''__'',chr(10))"

Thanks in advance,
Ramez Nabil
0
Comment
Question by:Ramez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37810621
I'm not understanding what you are wanting.

Can you post some sample data and expected results?
0
 

Author Comment

by:Ramez
ID: 37811653
Well the select statement is a text value of a column
I need to update this text from:

select
      to_char(column1)
from
      Test


To be like this:
-----------------

select
      replace(to_char(column1),''__'',chr(10))
from
      Test


The part of "column1" should not be changed.
Also I need to add   ,''__'',chr(10))    After (column1)
0
 
LVL 32

Accepted Solution

by:
awking00 earned 1000 total points
ID: 37811831
The question is still not clear. Can you show a sample value for column1 and what it should look like in your select statement? Would it be something like the following?
column1 value =
abc__def__ghi
select value =
abc
def
ghi
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1000 total points
ID: 37812105
I agree.  I still do not completely understand what you want but I'll take a guess you are wanting to concatenate/append values to the end of the column:


select
      column1 || ',''__'',' ||chr(10)
from
      Test
0
 

Author Comment

by:Ramez
ID: 37818576
Sorry guys, I'm really trying!

OK, I've a a column by name "Statement" on table "Report", the value of this column is a select statement as the following:

select
      to_char(column1)
from
      Test

I want to make an update statement on table "Report" to update value of column "Statement" to be as following instead of the above value:

select
      replace(to_char(column1),''__'',chr(10))
from
      Test

The part of column value "to_char" sould be changed to "replace(to_char"
The part of column value "column1" has got a different value above the table, its value is "ID" on one record and on another record is "social_no", so this part should be remains as it is in each row wthout any changes.
After the part of "column1" we should add the part of ",''__'',chr(10))" to the end of select clause.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37823111
Please provide sample data and expeected results.

What we are looking for is something like:
Given the data below:
col1, col2, col3
a,b,c
d,e,f
g,h,i

I need to update the table and end up with:
???????????
0
 
LVL 32

Expert Comment

by:awking00
ID: 37823153
Can you post some sample values for the statement column as they exist in the report table and what they should look like after the update, including some that may change and some that remain the same?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to recover a database from a user managed backup

610 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