View previous topic :: View next topic
|
Author |
Message |
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
Hi,
I am using a table in which one column is defined as below:
EMP_INFO CLOB (5M) NOT NULL
I am storing data of size 342575 bytes into column EMP_INFO
After inserting rows into this table, I am trying to use SUBSTRING to see the last 100 bytes of stored data and using below query (in SPUFI):
SELECT SUBSTRING(CLOB(EMP_INFO), 342475, 100)
FROM EMP_TAB
FETCH FIRST 1 ROW ONLY
WITH UR;
But, I am getting SQLCODE # -171, ERROR: THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT 3 OF SUBSTRING IS INVALID
Please someone help me to correct my query.
Thanks. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Have you run a query to determine the actual length of each value of EMP_INFO?
Why did you not use the code tags for your query? Code tags should be used for all data and code. |
|
Back to top |
|
|
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
Hi,
The actual length of EMP_INFO is 342575 and I am executing the query in SPUFI and got the sql error as mention in my earlier post.
Thanks.. |
|
Back to top |
|
|
sasanka Warnings : 1 New User
Joined: 18 Jan 2008 Posts: 34 Location: India
|
|
|
|
Hi,
Can anyone please provide me a correct query with SUBSTRING used on a CLOB column of a table.
Thanks |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Let us see if you are right about the offset, Try this.
Code: |
SELECT SUBSTRING(CLOB(EMP_INFO), 342475)
FROM EMP_TAB
FETCH FIRST 1 ROW ONLY
WITH UR;
|
Quote: |
The actual length of EMP_INFO is 342575 |
How did you find this? And why not to filter only the employee that is in context( the one you inserted)? Or if everything is right then what value is stored in that position as then, you may need CAST function to make it compatible? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
Can anyone please provide me a correct query with SUBSTRING used on a CLOB column of a table. |
You have already asked for help - do not repeat yourself. Responses are made if:
Someone knows
Someone wants to answer
This is a volunteers board - no one gets paid for responding and they do it, if they do it, as and when they see fit. |
|
Back to top |
|
|
|