Using in clause having more than 4000 chars in a VO.
Hi Experts,
JDEV version 11.1.1.5.0
I have a problem passing a bind variable having length of more than 4000 chars in ADF for use in a IN clause.
For e.g the query is
select user_id from employees where user_name in (
SELECT column_value
FROM TABLE (CAST (in_list_char (nvl( 'apple,oranges',user_name) ) AS ChartableType)) A)
in_list_char is function returning an array of type ChartableType.
ChartableType is a type
create or replace TYPE "CHARTABLETYPE" as table of varchar2(4000);
It works if the bind value that I pass is of length less than 4000 chars.
Anything higher it breaks and throws ORA-01460: unimplemented or unreasonable conversion requested.
Have even tried changing the ChartableType varchar2 length to 32767..but no luck.
Any help would be appreciated.
Hi Timo,
I am using a in clause as the value that I pass as a bind variable is not stored anywhere in the db for me to have a join or a subselect.
It's a comma separated string (comma separated user names) for which I would need to check against the employee table to fetch the user_id's .
An alternative would be to store those values in temp table and have a join.
But then I was trying to find an alternative , either having a OR clause or UNION dynamically appended to my VO
Any help is much appreciated.
Similar Messages
-
Help in using listagg function for more than 8000 char.
Hi Friends,
Need you urgent help in using listagg function for more than 8000 char.
I did the below sample SQL and in "e_orig" and "d_orig" for upto 4000 char it is working fine but I have to use it for more than 8000 char. and it is giving error,
I checked the listagg function is having limitation of 4000 char.
I tried but I am unable to achive this. Can someone provide me a sample example to achive this
select d.dname,d.loc,e.hiredate
,listagg(e.ename,',' ) within group (order by e.deptno) over (partition by e.deptno) as e_orig
,listagg(e.ename, ',') within group (order by e.sal) over (partition by e.deptno) as d_orig
from emp e, dept d
where e.deptno=d.deptno;[ This is my first post, I gone through the guideline for posting a post , and try to go according to that ( I have not pasted here create table and insert as I have used basic table emp, dept for example), please let me know if still I should give this, I will take care from my next post ]
Thanks in advanceInteresting, I didn't know you could do that, but...
BluShadow wrote:
You could write some PL/SQL code that does it all for you, but that would involve loops and would be slow.Well, objects are written in PL/SQL aren't they? And presumably there'll be implicit looping too? So it's not at all obvious that this method will be faster than doing the joining in PL/SQL in memory. The only way to find out is to benchmark them - so I have done that.
I noticed that OP's ref cursor actually only ever retrieves a single record for a bound department number, so I decided the best thing would be to test using a procedure that passes an output string back. I selected all (109) employees and put spaces in to ensure above 4000 characters. I also noticed that as he is using PL/SQL he probably can use a VARCHAR2 type, but just not ListAgg in the query, so I wrote short procedures as follows:
SimpleAggChr - bulk collect and array processing, VARCHAR2 output
ClobAggPrc - the custom aggregation method, CLOB output
SimpleAggClob - bulk collect and array processing, CLOB output
I then wrote a driving script that calls them in the order above and times each call (I like benchmarking so I have my own timing object to make it easy). I then print the lengths for checking, and my object writes the timings to my output table. Running a few times I got varying results, but generally it looks like there isn't a lot to choose between them for performance.
Here's the procedure code:
CREATE OR REPLACE TYPE char100_list_type AS TABLE OF VARCHAR2(100)
CREATE OR REPLACE PROCEDURE SimpleAggChr (x_out OUT VARCHAR2) IS
l_enames char100_list_type;
BEGIN
SELECT first_name || ' ' || last_name
BULK COLLECT INTO l_enames
FROM employees
ORDER BY salary;
FOR i IN 1..l_enames.COUNT LOOP
x_out := x_out || l_enames(i) || ',';
END LOOP;
END SimpleAggChr;
CREATE OR REPLACE PROCEDURE SimpleAggClob (x_out OUT CLOB) IS
l_enames char100_list_type;
BEGIN
SELECT first_name || ' ' || last_name
BULK COLLECT INTO l_enames
FROM employees
ORDER BY salary;
FOR i IN 1..l_enames.COUNT LOOP
x_out := x_out || l_enames(i) || ',';
END LOOP;
END SimpleAggClob;
SHO ERR
PROMPT ClobAggPrc
CREATE OR REPLACE PROCEDURE ClobAggPrc (x_out OUT CLOB) IS
BEGIN
SELECT clobagg(first_name || ' ' || last_name || ',')
INTO x_out
FROM employees
ORDER BY salary;
END ClobAggPrc;
SHO ERRand the driving script:
SET SERVEROUTPUT ON
SET TIMING ON
DECLARE
l_enames_c1 CLOB;
l_enames_c2 CLOB;
l_enames_v VARCHAR2(32767);
l_timer timer_set_type := timer_set_type ('Aggregation');
BEGIN
Utils.g_id := 'Aggregation';
SimpleAggChr (l_enames_v);
l_timer.Increment_Time ('SimpleAggChr');
ClobAggPrc (l_enames_c1);
l_timer.Increment_Time ('ClobAggPrc');
SimpleAggClob (l_enames_c2);
l_timer.Increment_Time ('SimpleAggClob');
DBMS_Output.Put_Line ('SimpleAggChr returned string of length ' || Length (l_enames_v));
DBMS_Output.Put_Line ('ClobAggPrc returned string of length ' || Length (l_enames_c1));
DBMS_Output.Put_Line ('SimpleAggClob returned string of length ' || Length (l_enames_c2));
l_timer.Write_Times;
END;
SET TIMING OFF
SET LINES 150
SET PAGES 1000
COLUMN id FORMAT A30
COLUMN line_text FORMAT A120
SELECT line_text
FROM output_log
WHERE id = 'Aggregation'
ORDER BY line_ind
/and the results:
SimpleAggChr returned string of length 5779
ClobAggPrc returned string of length 5779
SimpleAggClob returned string of length 5779
PL/SQL procedure successfully completed.
Elapsed: 00:00:27.05
LINE_TEXT
Timer Set: Aggregation, constructed at 03 Nov 2011 16:27:07, written at 16:27:35
================================================================================
[Timer timed: Elapsed (per call): 0.02 (0.000016), CPU (per call): 0.01 (0.000010), calls: 1000, '***' denotes corrected
line below]
Timer Elapsed CPU Calls Ela/Call CPU/Call
SimpleAggChr 9.84 0.36 1 9.84400 0.36000
ClobAggPrc 9.37 0.32 1 9.37400 0.32000
SimpleAggClob 8.25 0.22 1 8.25000 0.22000
(Other) 0.00 0.00 1 0.00000 0.00000
Total 27.47 0.90 4 6.86700 0.22500
13 rows selected. -
ORA-01704:String literal too long with update of more than 4000 chars
Hi,
I want to update a table column in Oracle Database(version 10) with more than 4000 chars.
The datatype of the table column is NCLOB.
I want to achieve this with one single line of update query as below,
update mytable set MY_DESCRIPTION = 'longdesc' where ID = '111' ;
But there's a problem, if the 'longdesc' is more than 4000 chars, it gives the error , "ORA-01704:String literal too long"
How can I achieve this in sql developer ?
I dont want to do this using stored procedures, I want to do this update using only sql statement.
Please help.
thanks,
sudhakarHello Sudhakar,
I am afraid, this will never work by SQL.
Just because an SQL-Statement must not contain a string literal over 4,000 characters (or did that change lately?).
Maybe you can bypass the limit with PL/SQL ... but you will certainly run into the 32K limit sooner or later
regards
Peter -
Need to insert into a table 1 of the fields (CLOB)with more than 4000 chars
Dear Gurus,
As far I understood, I need to write a function which get as parameter the large text and using bind variables I can return a CLOB containing more than 4000 chars. I tried all I can do and feel I want to died. Please, can I get specified help in this issue?
I APPRICIATE YOUR HELP, MARCELO.*** Duplicate Post ***
Please, Marcelo, use the forum properly. Pick a single group and post there.
Thank you. -
PL/SQL process returning message with more than 4000 chars
In our apex application we are using a pl/sql process returning a message.
This message should be shown to the user.
Our problem is now, that the application items in APEX seem to be limited to 4000 chars and the message can be longer.
We are also not able to use a collection, because we can't print the content of a collection in the "Process Success Message".
Here is the content of a page process which is running on page load after header:
Name - Type: PL/SQL anonymous block
Source - Process: :AI_TEST := p0001_pkg.get_text;
Messages - Process Success Message: &AI_TEST.
Image from process [https://twitter.com/OliverLemm/status/324058809138032640/photo/1/large]
If the page is called the result is this error message:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Technical Info (only visible for developers)
is_internal_error: false
ora_sqlcode: -6502
ora_sqlerrm: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
component.type: APEX_APPLICATION_PAGE_PROCESS
component.id: 16433072916569237418
component.name: get_text
error_backtrace:
ORA-06512: at "APEX_040200.WWV_FLOW_PROCESS", line 100
ORA-06512: at "APEX_040200.WWV_FLOW_PROCESS", line 141
Edited by: Oliver L on 16.04.2013 09:17no an item like P0_TEST on page 0 / global page also does not help.
But the error is not the application item / page item it's the problem that the "Process Success Message" can't handle more than 4000 chars.
I tried to paste a string into the process success message, but the error "Error processing row. ORA-01461: can bind a LONG value only for insert into a LONG column" occured even when i filled the textarea and saved the process.
So there's no problem with the application item or page item.
Edited by: Oliver L on 16.04.2013 10:00 -
Title above ALV grid is having more than 70 chars.
Hi friends ,
I have a requirement in which title above ALV grid is having more than 70 chars.
But the layout structure of ALV (slis_layout_alv) is having a component called wiindow_title which is having maximum length of 70 chars. How to show the text having more than 70 chars over here ?Hello Abhijit,
Its not possible to display more than 70 characters in ALV Title. May be you can try using Top of page and ALV list commentary write.
Regards,
Karthik D -
Reading contents of a BLOB datatype having more than 4000 characters.
Hi,
I am unable to read contents of a column having BLOB datatype.I tried using ult_raw.cast_varchar2(Col_name) procedure,but since varchar2 has a size limit of 4000 bytes,complete contents are not visible.
Pl. suggest some way to view the contents.
Regards,
Saket BansalIn the link that you mentioned a procedure is used that gets the length first then loops through if length is greater than 32760.
I mean to say can user get the output in a single SQL query e.g.
select utl_raw.cast_to_varchar2(column_name) from table_name;something like this for bytes greater than 4000 bytes.
----- Read your reply a bit late thanks.
Edited by: Avi on Mar 2, 2009 1:21 AM -
Using "in clause" for more than one collumn
Hallo,
for the following statement, I got the error "FEHLER in Zeile 16:
ORA-00920: Ungultiger relationaler Operator". What is wrong on it?
SELECT
'ALTER TABLE ' ||
c.owner ||
'.' ||
c.table_name ||
' MODIFY(' ||
'"' ||
c.column_name ||
'"' ||
c.data_type ||
'(' ||
c.data_length*1.3 ||
FROM
sys.dba_tab_columns c
where (owner, table_name, column_name) in
SELECT 'user1'||', '||'table1'||', '||'collumn3' FROM DUAL UNION ALL
SELECT 'user2'||', '||'table17'||', '||'collumn23' FROM DUAL
Thank you for your help!
Paul... and it does not work! :-(
# A
This statement works:
SELECT
'ALTER TABLE ' ||
c.owner ||
'.' ||
c.table_name ||
' MODIFY(' ||
'"' ||
c.column_name ||
'"' ||
c.data_type ||
'(' ||
round(c.data_length*1.3) ||
FROM
sys.dba_tab_columns c
where (c.owner, c.table_name, c.column_name) IN
('SYS', 'GV_$DB_CACHE_ADVICE', 'INST_ID')
# B
if I insert the following sub select, it does not work ...
SQL> SELECT
2 'ALTER TABLE ' ||
3 c.owner ||
4 '.' ||
5 c.table_name ||
6 ' MODIFY(' ||
7 '"' ||
8 c.column_name ||
9 '"' ||
10 c.data_type ||
11 '(' ||
12 round(c.data_length*1.3) ||
13 '));'
14 FROM
15 sys.dba_tab_columns c
16 where (c.owner, c.table_name, c.column_name) IN
17 (select '('||'''SYS'||''', '''||'GV_$DB_CACHE_ADVICE'||''', '''||'INST_ID'''||')' from dual);
(select '('||'''SYS'||''', '''||'GV_$DB_CACHE_ADVICE'||''', '''||'INST_ID'''||')' from dual)
FEHLER in Zeile 17:
ORA-00947: Anzahl der Werte reicht nicht aus
# C
the result of the sub select is the following ....
select '('||'''SYS'||''', '''||'GV_$DB_CACHE_ADVICE'||''', '''||'INST_ID'''||')' from dual;
('SYS', 'GV_$DB_CACHE_ADVICE', 'INST_ID')
Has any one an idea?
Paul
Sorry! I think the last reply was needless!
Sorry for wasting your time!
Paul
Message was edited by:
talloom_nagar -
FUNCTION returning more than 4000 characters
I am calling the below function from a view, and function is failing because it returning more than 4000chars.
An I know when the return type is varchar2 it cannot return more than 4000 chars.
It's working fine when I use CLOB for the return type. Is there any other better option to handle this err.
CREATE OR REPLACE FUNCTION FN_CONCATENATE_COMMENTS (
P_CASENO IN PATIENT_DET.CASE_NO%TYPE,
P_POLICY IN PATIENT_DET.POLICYNO%TYPE
RETURN VARCHAR2
AS
V_TEMP VARCHAR2(300);
V_COMMENT VARCHAR2(30000);
CURSOR FETCHCOMMENT IS
SELECT TO_CHAR (C.CREATED_TS,'mm/dd/yyyy hh:mi:ss AM - ')|| C.DOC_COMMENT_DESC DOC_COMMENT_DESC
FROM TREATEMENT_DET C
WHERE C.CASE_CD = P_CASENO AND C.POLICY_N0 = P_POLICY
ORDER BY C.CREATED_TS ;
BEGIN
OPEN FETCHCOMMENT;
LOOP
FETCH FETCHCOMMENT INTO V_TEMP;
EXIT WHEN FETCHCOMMENT%NOTFOUND;
V_COMMENT := V_COMMENT ||' '|| TRIM(V_TEMP) ||' ';
END LOOP;
CLOSE FETCHCOMMENT;
RETURN V_COMMENT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('SYSTEM ERROR PLEASE CONTACT DBA ' || SQLERRM);
END FN_CONCATENATE_COMMENTS;HI
Welcome to the forum!
try this please.
-- IT IS NOT TESTED --
CREATE OR REPLACE FUNCTION FN_CONCATENATE_COMMENTS (
P_CASENO IN PATIENT_DET.CASE_NO%TYPE,
P_POLICY IN PATIENT_DET.POLICYNO%TYPE
RETURN VARCHAR2
AS
V_TEMP VARCHAR2(300);
V_COMMENT CLOB;
CURSOR FETCHCOMMENT IS
SELECT TO_CHAR (C.CREATED_TS,'mm/dd/yyyy hh:mi:ss AM - ')|| C.DOC_COMMENT_DESC DOC_COMMENT_DESC
FROM TREATEMENT_DET C
WHERE C.CASE_CD = P_CASENO AND C.POLICY_N0 = P_POLICY
ORDER BY C.CREATED_TS ;
BEGIN
OPEN FETCHCOMMENT;
LOOP
FETCH FETCHCOMMENT INTO V_TEMP;
EXIT WHEN FETCHCOMMENT%NOTFOUND;
V_COMMENT := V_COMMENT ||' '|| TRIM(V_TEMP) ||' ';
END LOOP;
CLOSE FETCHCOMMENT;
RETURN DBMS_LOB.SUBSTR(V_COMMENT ,32000,1);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('SYSTEM ERROR PLEASE CONTACT DBA ' || SQLERRM);
END FN_CONCATENATE_COMMENTS;Edited by: Mahir M. Quluzade on Apr 22, 2011 1:45 PM
Edited by: Mahir M. Quluzade on Apr 22, 2011 1:46 PM -
Need ouput more than 4000 characters
Hi , how to create a script that fetches more than 4000 charaters in the ouput
declare your pl/sql variable as varchar2(32767) which is the maximum and then you can select that amount.Not so fast Blu ;)
SQL> create or replace function f
return varchar2
as
begin
return lpad ('x', 32767, 'x');
end f;
Function created.
SQL> exec dbms_output.put_line(length(f))
32767
PL/SQL procedure successfully completed.
SQL> select length (f) from dual
select length (f) from dual
Error at line 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "MICHAEL.F", line 5To SELECT more than 4000 chars you'll always need a CLOB .. -
Hi.. I am using the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" for sending a outlook mail with excel sheet as an attachment.
The records having length upto 255 chars are coming properly in diff rows(which means the carriage return is considered).
But when records have more than 255 chars, then the chars exceeding 255 length are coming in a single row of excel sheet which means the carraige returns are not considered.
Hope my issue is explained clearly....request every one to provide the solution as early as possible.
Regards
NandaHi Nanda,
build your XLS internal table X as usual (more then 255 char). Then format the table
X to a new one Y with line size 255. (You can do your own routine or use the FM SWA_STRING_FROM_TABL and SWA_STRING_TO_TABLE in sequence; sorry but I'm on 4.6C and didn't find a FM in order to format directly the internal table from line size XXXX to the desired line size).
sample code:
t_att_tab with line size 4000 containing the excell data with carriage return and so on
objbin with line size 255 used in FM SO_NEW_DOCUMENT_ATT_SEND_API1
data: d_string type string.
call function 'SWA_STRING_FROM_TABLE'
exporting
character_table = t_att_tab
NUMBER_OF_CHARACTERS =
line_size = 4000
KEEP_TRAILING_SPACES = ' '
CHECK_TABLE_TYPE = ' '
importing
character_string = d_string
exceptions
no_flat_charlike_structure = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'SWA_STRING_TO_TABLE'
exporting
character_string = d_string
APPEND = ' '
line_size = 255
CHECK_TABLE_TYPE = ' '
importing
character_table = objbin
TOTAL_LENGTH =
LINE_SIZE_USED =
LINES_FILLED =
LAST_LINE_LENGTH =
exceptions
no_flat_charlike_structure = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
It works!!!
Paolo -
Cannot insert more than 4000 characters using PL/SQL SP to LONG columns
I have created a stored procedure which will insert more than 4000 characters in a table having long column.
The stored procedure body is as follows :
CREATE OR REPLACE PROCEDURE INSERTTOTEST(P_ZUNIQUEID IN VARCHAR2,P_LONGVAL IN LONG)
AS
BEGIN
insert into CLOBVALUESHOW(zuniqueid, longval) VALUES (p_zuniqueid, p_longval) ;
COMMIT;
END INSERTTOTEST;
When I use the RPAD function as below, it executes without any error :
EXEC INSERTTOTEST('ABCD123',rpad('',32000,'*'))*
But when I run with real-time values like the following string value :
'[ERROR] [JTA_Command_Insert_tCatalog]Error invoking Transaction Command action: JTATransactionCommand - A SQL Command Exception occured against JNJ_MDD_OCD_CPL_DS with the following command BEGIN INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1988211','09','ALB','33','NA','0','','','','ALB','8','522','305','710','50','17','208','165','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1988211','09','ALB','33','NA','0','','','','ALB','8','522','305','710','50','17','208','165','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('8257289','67','GGT','15','NA','0','','','','GGT','8','543','305','710','50','21','323','250','','','SP','1','0','','0','0','0','0','0','2','0','0','0','2','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1513209','12','PHOS','33','11','12','','','','PHOS','8','507','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1513209','12','PHOS','33','11','12','','','','PHOS','8','507','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1513209','12','PHOS','33','11','12','','','','PHOS','8','507','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1450261','03','CA','33','NA','0','','','','Ca','8','506','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1450261','03','CA','33','NA','0','','','','Ca','8','506','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1450261','03','CA','33','NA','0','','','','Ca','8','506','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1513209','12','PHOS','33','11','12','','','','PHOS','8','507','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0'); INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, tCatalog_SAPImport.StoreTemp, tCatalog_SAPImport.CartonCode, tCatalog_SAPImport.GrossLeakLimit, tCatalog_SAPImport.LeakLimit, tCatalog_SAPImport.CompValue, tCatalog_SAPImport.ProductType,tCatalog_SAPImport.CheckWeighHi, tCatalog_SAPImport.CheckWeighLo, tCatalog_SAPImport.SO_MASK, tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1450261','03','CA','33','NA','0','','','','Ca','8','506','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0');'*
I get the error -
Error starting at line 1 in command:
exec P_TESTCLOB(6, '[ERROR] [JTA_Command_Insert_tCatalog]Error invoking Transaction Command action: JTATransactionCommand - A SQL Command Exception occured against JNJ_MDD_OCD_CPL_DS with the following command BEGIN INSERT INTO tCatalog_SAPImport( tCatalog_SAPImport.CatalogNo, tCatalog_SAPImport.SONumber, tCatalog_SAPImport.ChemName, tCatalog_SAPImport.RH, tCatalog_SAPImport.ExpireMonth, tCatalog_SAPImport.SlidesPerCart, tCatalog_SAPImport.IDEXX_PART_NBR, tCatalog_SAPImport.TOP_FOIL_MATL_NBR, tCatalog_SAPImport.BTM_FOIL_MATL_NBR, tCatalog_SAPImport.AltChemName, ………..tCatalog_SAPImport.CAL_CURVE_PFX, tCatalog_SAPImport.PROD_INP_TYP, tCatalog_SAPImport.CTN_TUBE, tCatalog_SAPImport.SLIDE_STYLE, tCatalog_SAPImport.PROD_DESIG, tCatalog_SAPImport.SFM_AUD_RT, tCatalog_SAPImport.SPL_RT, tCatalog_SAPImport.FIRST_SLIDES_REM, tCatalog_SAPImport.SPL_FRONT, tCatalog_SAPImport.SPL_REAR, tCatalog_SAPImport.BARCODE_TYP, tCatalog_SAPImport.CHK_WEIGH_AIM, tCatalog_SAPImport.FOIL_TYP, tCatalog_SAPImport.CART_CLIP_PRES, tCatalog_SAPImport.TOP_LBL_TYP, tCatalog_SAPImport.FREEZER_MTH, tCatalog_SAPImport.OVERAGE_MTH) VALUES('1450261','03','CA','33','NA','0','','','','Ca','8','506','305','710','50','11','323','262','','','SP','1','0','','0','0','0','0','0','2','0','0','0','1','0','0');' *(the statement continues, I have trimmed it as it is not possible that amount of length in the forum. )*
Error report:
ORA-06550: line 1, column 1398:
PLS-00103: Encountered the symbol "1988211" when expecting one of the following:
) , * & = - + < / > at in is mod remainder not rem =>
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Can anyone tell me why I am getting this error executing the same STORED PROCEDURE while inserting into the LONG column but when using RPAD functions for executing the same STORED PROCEDURE its not happening ?>
But then why will the problem happen with this long string ?
>
You don't have a 'long string'. You have a lot of single-quoted strings combined with some unquoted strings.
There are embedded singel quotes in what you call 'this long string'.
Try using a different string delimiter so that the quotes do not cause a problem.
You can use an exclamation point ('!') since there is none in the text you provided.
Here is an example of what will not work because there is one embedded single quote
'name LIKE '%DBMS_%%'This is the same value using exclamation as the delimiter - this works because there is no exclamation in the string
q'!name LIKE '%DBMS_%%'!'1. q must be the first character
2. ' (single quote) must be the next character
3. ! (or any delimiter you choose) is the next character
4. abcdefg. . . -- this is your string that can include single quotes but not an exclamation point
5. ! is the next to last character - must be the same delimiter used as the third character
6. ' (single quote) is the last character
See the 'Text Literals' section of the SQL Reference for more examples
http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm
Note that this one will not work because the string includes the percent
This is the same value using exclamation as the delimiter - this works because there is no exclamation in the string
q'%name LIKE '%DBMS_%%'%' -
Insert more than 4000 characters using sql plus
I have a SQL script that creates a database. The problem is that some of the fields are longer than 4000 characters in the INSERT statement and Oracle doesn't seem to like it.
The field is a clob and works fine in the application (i.e. I can insert more than 4000 characters using the app) - how do I achieve this in a SQL script?
Any help is much appreciated.
Cheers,
SteveHi,
This pl/sql block works absolutely fine in SQL*Plus inserting > 4000 characters into clob column:
declare
l_str varchar2(8000);
l_str1 varchar2(2400) := 'first part of the verly long string...';
l_str2 varchar2(2400) := 'second part of the verly long string...';
begin
l_str := l_str1 || l_str2;
insert into tmpl values (l_str);
end;
So, you'll have to replace inserts with pl/sql blocks in your script.
Tested in Oracle 8.1.7.0.0
Regards,
Andrew Velitchko
BrainBench MVP for Developer/2000
http://www.brainbench.com -
How to perform Text length more than 4000 bytes
I want to read each row from txt file
and used utl_file pacage to concat contents into a variable,
the variable datatype is varchar2(4000), so text length can't more than 4000 bytes,
but I wish get full text from txt file, How can I do?Thans! Detlev.
I have a code :
PROCEDURE read_file( path in varchar2, filename in varchar2, msg in out varchar2) AS
data_line varchar2(4000);
ifile utl_file.file_type;
BEGIN
ifile := utl_file.fopen(path,filename,'R');
LOOP
utl_file.get_line( ifile, data_line);
msg := msg | | rtrim(data_line);
END LOOP;
utl_file.fclose(ifile);
EXCEPTION
WHEN no_data_found THEN
utl_file.fclose(ifile);
END;
My question is
1. The msg length can't more than 4000
2. I use utl_raw.cast_to_raw function, that can't cast varchar2 to raw if varchar2 length more than 2048
3. If I want to change the data type varchar2 to raw,
the utl_raw.concat function can't use Loop ....end loop clause,
So that only use utl_raw.concat(ra1, ra2,ra3,ra4,ra5, ... ra12)
I want to concat all line to a raw datatype from text file , How can I do? -
Displaying more than 4000 characters
Hi
I have a report which would display a CLOB field having text of length around 32000 characters.
I tried to use DBMS_LOB.SUBSTR(<field_name>,32000,1) on the query so that it shows the text at least till 32000 characters on the report but it keeps returning an error ORA-06502 PL/SQL: numeric or value error string - character string buffer too small whenever it is more than 4000 characters in that particular field.
Can anyone pls suggest any solution ASAP?
Thanks
ArnabYou can split your clob in varchar2 4000 drop table tab1;
create table tab1 (
clsplit_id number(10) NOT NULL,
clsplit_type1val CLOB NULL,
clsplit_type2val CLOB NULL
drop type some_list;
drop type my_t;
create type my_t as object
id1 number,
clob_type number,
no_clob_lines number,
clob_line number,
clob_data varchar2(80)
show errors
create type some_list as table of my_t
show errors
insert into tab1 values(1, 'a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789leftover',
'a9876543210b9876543210c9876543210d9876543210e9876543210f9876543210leftover');
insert into tab1 values(2, '0aaaaaaaaaa1bbbbbbbbbb2cccccccccc3dddddddddd4eeeeeeeeee5ffffffffff',
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
insert into tab1 values(3, 'first has data, second null', null);
insert into tab1 values(4, null, 'first null second has data');
insert into tab1 values(5, 'short lob', 'short lob');
commit;
create or replace function some_func return some_list pipelined is
num_allowed_chars number := 4000;
clob1_len number;
clob2_len number;
loop_counter number;
col_name varchar2(100);
current_line number;
i integer;
out_rec my_t := my_t(NULL,NULL,NULL,NULL,NULL);
begin
for c1 in ( select clsplit_id, clsplit_type1val, clsplit_type2val from tab1 )
loop
-- get first clob
if c1.clsplit_type1val is not null then
clob1_len := dbms_lob.getlength(c1.clsplit_type1val);
if clob1_len > num_allowed_chars then
for i in 1..ceil(clob1_len/num_allowed_chars) loop
out_rec.id1 := c1.clsplit_id;
out_rec.clob_type := 1;
out_rec.no_clob_lines := ceil(clob1_len/num_allowed_chars);
out_rec.clob_line := i;
out_rec.clob_data := substr(c1.clsplit_type1val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
pipe row(out_rec);
end loop;
else
out_rec.id1 := c1.clsplit_id;
out_rec.clob_type := 1;
out_rec.no_clob_lines := 1;
out_rec.clob_line := 1;
out_rec.clob_data := c1.clsplit_type1val;
pipe row(out_rec);
end if;
end if;
-- get second clob
if c1.clsplit_type2val is not null then
clob2_len := dbms_lob.getlength(c1.clsplit_type2val);
if clob2_len > num_allowed_chars then
for i in 1..ceil(clob2_len/num_allowed_chars) loop
out_rec.id1 := c1.clsplit_id;
out_rec.clob_type := 2;
out_rec.no_clob_lines := ceil(clob2_len/num_allowed_chars);
out_rec.clob_line := i;
out_rec.clob_data := substr(c1.clsplit_type2val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
pipe row(out_rec);
end loop;
else
out_rec.id1 := c1.clsplit_id;
out_rec.clob_type := 2;
out_rec.no_clob_lines := 1;
out_rec.clob_line := 1;
out_rec.clob_data := c1.clsplit_type2val;
pipe row(out_rec);
end if;
end if;
end loop;
return;
end;
show errors
select * from
table(select some_func() from dual)
order by 1,2,4;
Maybe you are looking for
-
Set_variable does not work
Hello, I am trying to produce a serial number in the RTF template and this is my way: I Put in the text form field : <?xdoxslt:set_variable($_XDOCTX, 'x', xdoxslt:get_variable($_XDOCTX, 'x')+1)?><?xdoxslt:get_variable($_XDOCTX, 'x')?> but when i re
-
Multiple Quizzes with multiple results (in Captivate 6)
Hey guys, Thanks for reading! Does anyone know if it is possible to do multiple tests with multiple results in captivate 6? or if it is possible to have a pre-test with a quiz, and have separate results for each? I've been having a play with captivat
-
I just looked in the store and Apple doesn't seem to sell this, but I am looking for a female/male connector cable. Essentially, I need a cable that replicates an iPhone dock at one end (male) and then plugs into the dock with the female end so I can
-
OK, Well I have been running into issue trying to get ODBC to function on our Oracle Enterprise Linux Server. I have gotten all the way where I can connect to the Database via isql and DataManager however anything I do gives me this error. [ISQL]ERRO
-
Help. I lose connection after standy-by
Hello, I am Adriano, from Italy. Please, I have an iPad connected with D-link G624T (used as router). The connection is protected by password, with dynamic Ip and no Dhcp specifications. It runs everytime I switch on, but if it rests in stand-by and