Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.oracle.misc > #915

Re: SELECT A CLOB - GROUP BY

Newsgroups comp.databases.oracle.misc
Date 2015-06-23 08:07 -0700
References (3 earlier) <76ea9e0e-3bd4-489e-90e0-9981ed5d2203@8g2000hse.googlegroups.com> <47f64f13$0$14343$e4fe514c@news.xs4all.nl> <e2cb990f-1c6f-40ac-b154-c89f864104e8@n58g2000hsf.googlegroups.com> <47fc7618$0$14356$e4fe514c@news.xs4all.nl> <857d4322-df93-486c-a243-74c8ac86c581@googlegroups.com>
Message-ID <80d04723-b160-41b9-8edb-e08380e9fe1c@googlegroups.com> (permalink)
Subject Re: SELECT A CLOB - GROUP BY
From ddf <oratune@msn.com>

Show all headers | View raw


On Tuesday, June 23, 2015 at 1:02:51 AM UTC-6, saluj...@gmail.com wrote:
> On Wednesday, 9 April 2008 13:23:51 UTC+5:30, Shakespeare  wrote:
> > <trpost@gmail.com> schreef in bericht 
> > news:e2cb990f-1c6f-40ac-b154-c89f864104e8@n58g2000hsf.googlegroups.com...
> > > Is there anything that can be done with a PLSQL function to convert a
> > > CLOB to a VARCHAR2 to a size larger than 4000 characters? I read that
> > > PLSQL can handle a VARCHAR2 with 32767 charcaters, so is it possible
> > > to write a function to return this conversion?
> > >
> > > I found the following, but couldn't get it to compile:
> > >
> > > CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN OUT CLOB)
> > > return VARCHAR2
> > > IS
> > >
> > > cnuMAX_LENGTH Constant number := 32767 ;
> > > nuLength Number := DBMS_LOB.getlength(iclCLOB);
> > > sbBuffer varchar2(32767);
> > >
> > > DBMS_LOB.read(iclCLOB,nuLength,1,bBuffer);
> > > return sbBuffer;
> > > END
> > >
> > > Thanks
> > >
> > 
> > Is the case_list the same for every 'PRODUCT_NAME'?
> > If it is, don't select it on forehand, but do the group by first and then 
> > look up the case list
> > If it's not, it makes no sense to do a group by at all.
> > 
> > Shakespeare
> 
> I want to use group by function onm CLOB as I want to match part of one CLOB data to another.Can anyone please help

I'm lost -- how does group by match partial strings?

Here's an example of matching part of a string in a CLOB field:

SQL> create table mylob (myid number not null,
  2          mytext clob);

Table created.

SQL>
SQL> begin
  2          for i in 1..100 loop
  3                  insert into mylob
  4                  values(i, 'Text:  '||to_char(to_date(i, 'J'), 'JSP')||' and a partridge in a pear tree');
  5          end loop;
  6
  7          commit;
  8
  9  end;
 10  /

PL/SQL procedure successfully completed.

SQL>
SQL> select dbms_lob.substr(mytext, dbms_lob.instr(mytext, 'ONE'), 8)
  2  from mylob
  3  where dbms_lob.instr(mytext, 'ONE') > 0;

DBMS_LOB.SUBSTR(MYTEXT,DBMS_LOB.INSTR(MYTEXT,'ONE'),8)
-----------------------------------------------------------------------------------------------------------------------------
ONE and
TWENTY-ONE and
THIRTY-ONE and
FORTY-ONE and
FIFTY-ONE and
SIXTY-ONE and
SEVENTY-ONE and
EIGHTY-ONE and
NINETY-ONE and
ONE HUND

10 rows selected.

SQL>


David Fitzjarrell

Back to comp.databases.oracle.misc | Previous | NextPrevious in thread | Find similar


Thread

Re: SELECT A CLOB - GROUP BY salujareeta@gmail.com - 2015-06-23 00:02 -0700
  Re: SELECT A CLOB - GROUP BY ddf <oratune@msn.com> - 2015-06-23 08:07 -0700

csiph-web