Link to home
Start Free TrialLog in
Avatar of Ramez
RamezFlag for Egypt

asked on

I need an update statement

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
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

I'm not understanding what you are wanting.

Can you post some sample data and expected results?
Avatar of Ramez

ASKER

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)
ASKER CERTIFIED SOLUTION
Avatar of awking00
awking00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ramez

ASKER

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.
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:
???????????
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?