on 09-20-2007 11:47 PM
Here's the sql statement that we are running:
SELECT dbms_lob.substr(sql_statement,dbms_lob.getlength(sql_statement),1) sql_statement FROM query
WHERE query_tk = [Param.1]
If the sql_statement is > 4000 chars, we are getting this error:
Fatal Error
A SQL Error has occurred on query, ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 1 .
Maria,
You are seeing this error because you used 'dbms_lob.substr'.
substr is not a function of DBMS_LOB package. It is a standard function. Use just substr. But getlength is a function of DBMS_LOB.
substr(string,startposition,length) where length is optional parameter.
The statement you are trying to write will return only the last character of the sql_statement column!!! Did you really mean the length 1?
John
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you see this behaviour only in xMII? How about executing the same from some ORACLE Query Analyzer.
After reading some Oracle Forum posts it seems that data type varchar2 has the 4000 character limit ,could it be that the substr function returns a varchar2 and for such cases you might have to explicitly convert the returned value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are seeing this outside of xmii as well.
Here's the background. We originally tried to do a normal insert to the clob (thru xmii) but we got errors when inserting values of more than 4000 chars. So, we inserted the clob differently (code used below). That's when we started getting this new error. Is there another way to insert/retrieve clobs?
--INSERT "base" row if it does not already exist.
BEGIN
SELECT query_tk
INTO v_dummy
FROM query
WHERE query_tk = p_query_tk;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO query
(query_tk
,last_updated_timestamp
,sql_statement
)
VALUES
(p_query_tk
,SYSDATE
,'DUMMY');
END;
--Initialize buffer with data to be inserted
v_copy_length := LENGTH(p_sql_statement);
-- get LOB handle
SELECT sql_statement
INTO v_lobloc
FROM query
WHERE query_tk = p_query_tk
FOR UPDATE;
dbms_lob.write(v_lobloc,v_copy_length,1,p_sql_statement);
Oracle (like many DB vendors) uses a very non-standard mechanism for storing/retrieving BLOBs and CLOBs via JDBC. As such, I would suspect you'll have many challenges trying to do so with xMII. You might be best off building a "helper servlet", web service, or xMII "action", that xMII can invoke which would deal with the load/save operations.
The issue here seems to be that the SQL statement itself is failing (xMII or no xMII). In that case I am not sure how even the options suggested by you will work.
But yes if there's a way to standardize on the DB layer itself, then a custom action/webservice would be a better way of going about this.
User | Count |
---|---|
10 | |
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.