Re: SQL*PLUS Syntax for Concatenation

From: McGrath Glenda <glenda_at_beta.lanl.gov>
Date: 1995/08/23
Message-ID: <41drv1$ois_at_newshost.lanl.gov>#1/1


In article <dschellenberg.6.0011DCDA_at_man.net> , Dave Schellenberg <dschellenberg_at_man.net> wrote:
| We are running Oracle 7 on VAX/VMS.
| I have two questions dealing with SQL*PLUS
| (and maybe PL/SQL) that I need help with:
|
| Question 1:
|
| I have two tables, call them table1 and table2.
| I want something like this:
|
| UPDATE TABLE1
| SET TABLE1.COL2 = concatenated CHARs from TABLE2.COL2
| WHERE TABLE2.ID = TABLE1.ID;
|
| In other words, I just want to concatenate all of the strings from
| table2.column2, separating each with a space,
| and then set a much bigger CHAR
| in table1 to that string. I have no idea!
|
| Question 2:
|
| I want to find the second-highest date in a column in a table.
| It is too easy to find the highest, using MAX( ), but I can't think
| of how to find the next highest.
|

Solution to question 2:

        select max(x)
          from table1
         where x not in (select max(x)
                           from table1);

Anyone got a solution for question 1 without going to a more complex/powerful language than SQLPLUS?

glenda_at_lanl.gov Received on Wed Aug 23 1995 - 00:00:00 CEST

Original text of this message