Solved

I need an update statement

Posted on 2012-04-05
7
337 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 76

Expert Comment

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

Can you post some sample data and expected results?
0
 

Author Comment

by:Ramez
Comment Utility
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 31

Accepted Solution

by:
awking00 earned 250 total points
Comment Utility
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 250 total points
Comment Utility
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
Comment Utility
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 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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 31

Expert Comment

by:awking00
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 51
Oracle PL/SQL syntax 4 52
Oracle regular expression 6 29
sql query 9 18
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

771 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

11 Experts available now in Live!

Get 1:1 Help Now