dbTalk Databases Forums  

SELECT A CLOB - GROUP BY

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss SELECT A CLOB - GROUP BY in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
trpost@gmail.com
 
Posts: n/a

Default SELECT A CLOB - GROUP BY - 04-03-2008 , 04:56 PM






Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?

Reply With Quote
  #2  
Old   
trpost@gmail.com
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 09:47 AM






On Apr 3, 3:56*pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?
Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?


Reply With Quote
  #3  
Old   
trpost@gmail.com
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 09:47 AM



On Apr 3, 3:56*pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?
Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?


Reply With Quote
  #4  
Old   
trpost@gmail.com
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 09:47 AM



On Apr 3, 3:56*pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?
Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?


Reply With Quote
  #5  
Old   
trpost@gmail.com
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 09:47 AM



On Apr 3, 3:56*pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?
Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?


Reply With Quote
  #6  
Old   
Shakespeare
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 10:21 AM




<trpost (AT) gmail (DOT) com> schreef in bericht
news:132260f0-7ad9-4fe6-b9b1-e4c4904f366e (AT) 24g2000hsh (DOT) googlegroups.com...
On Apr 3, 3:56 pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?

Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?
Don't put your CLOB in the group by clause, just in the select and only
group by product_name. I don't expect you really want to group by a CLOB, do
you?

Shakespeare




Reply With Quote
  #7  
Old   
Shakespeare
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 10:21 AM




<trpost (AT) gmail (DOT) com> schreef in bericht
news:132260f0-7ad9-4fe6-b9b1-e4c4904f366e (AT) 24g2000hsh (DOT) googlegroups.com...
On Apr 3, 3:56 pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?

Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?
Don't put your CLOB in the group by clause, just in the select and only
group by product_name. I don't expect you really want to group by a CLOB, do
you?

Shakespeare




Reply With Quote
  #8  
Old   
Shakespeare
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 10:21 AM




<trpost (AT) gmail (DOT) com> schreef in bericht
news:132260f0-7ad9-4fe6-b9b1-e4c4904f366e (AT) 24g2000hsh (DOT) googlegroups.com...
On Apr 3, 3:56 pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?

Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?
Don't put your CLOB in the group by clause, just in the select and only
group by product_name. I don't expect you really want to group by a CLOB, do
you?

Shakespeare




Reply With Quote
  #9  
Old   
Shakespeare
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 10:21 AM




<trpost (AT) gmail (DOT) com> schreef in bericht
news:132260f0-7ad9-4fe6-b9b1-e4c4904f366e (AT) 24g2000hsh (DOT) googlegroups.com...
On Apr 3, 3:56 pm, trp... (AT) gmail (DOT) com wrote:
Quote:
Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?

Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?
Don't put your CLOB in the group by clause, just in the select and only
group by product_name. I don't expect you really want to group by a CLOB, do
you?

Shakespeare




Reply With Quote
  #10  
Old   
trpost@gmail.com
 
Posts: n/a

Default Re: SELECT A CLOB - GROUP BY - 04-04-2008 , 10:49 AM



On Apr 4, 9:21*am, "Shakespeare" <what... (AT) xs4all (DOT) nl> wrote:
Quote:
trp... (AT) gmail (DOT) com> schreef in berichtnews:132260f0-7ad9-4fe6-b9b1-e4c4904f366e (AT) 24g2000hsh (DOT) googlegroups.com...
On Apr 3, 3:56 pm, trp... (AT) gmail (DOT) com wrote:





Hi,

I am having trouble selecting a CLOB (CASE_LIST), here is what
happens:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, CASE_LIST
ORDER BY PRODUCT_NAME

I get this error: ORA-00932: inconsistent datatypes: expected - got
CLOB

Then I did this, using TO_CHAR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
TO_CHAR(CASE_LIST)
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, TO_CHAR(CASE_LIST)
ORDER BY PRODUCT_NAME

I get this error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB
to RAW conversion (actual: 4997, maximum: 4000)

So lastly I did this, using DBMS_LOB.SUBSTR:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1) CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME, DBMS_LOB.SUBSTR(CASE_LIST, 4000, 1)
ORDER BY PRODUCT_NAME

I am now able to get results, but my data is truncated at 4000
characters, which will not work

Any ideas on how to get the full clob results in one query?
Is it possible to Select a CLOB in a GROUP BY? Is there a work around
for when TO_CHAR exceeds 4000 characters?

Don't put your CLOB in the group by clause, just in the select and only
group by product_name. I don't expect you really want to group by a CLOB, do
you?

Shakespeare- Hide quoted text -

- Show quoted text -
If I do that I get an error:

SELECT PRODUCT_NAME AS "Product Name", SUM(CASES_CREATED) AS "Cases
Created",
CASE_LIST
FROM PEOPLESOFTBUCUSTPROD
GROUP BY PRODUCT_NAME
ORDER BY PRODUCT_NAME

ORA-00979: not a GROUP BY expression


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.