Selecting clob data
Hi,
I have a table which contains a column of clob type.
When i do select * on that table i am not able to get the data.
Can anybody tell how to select the data from a table that contains clob columns.
cheers
RRK
Can you explain...
SQL> create table test
2 (c1 clob);
SQL> insert into test
2 values('ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
3 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
4 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
5 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
6 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
7 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
8 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
9 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
10 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
11 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
12 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
13 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
14 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
15 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
16 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
17 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
18 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
19 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
20 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
21 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
22 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
23 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
24 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
25 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
26 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
27 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
28 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
29 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
30 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
31 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
32 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
33 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
34 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
35 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
36 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
37 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
38 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
39 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
40 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
41 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
42 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
43 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
44 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
45 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
46 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
47 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
48 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
49 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
50 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
51 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
52 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
53 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
54 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
55 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
56 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
57 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
58 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
59 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
60 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
61 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
62 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
63 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
64 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
65 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
66 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
67 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
68 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
69 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
70 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
71 ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
72 shfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
73 ')
74 /
1 row created.
SQL> select *
2 from test;
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaa
SQL> set long 32000
SQL> select *
2 from test;
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
C1
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
ashfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
shfsadfsdfsaaaaaaaaaaaaaaaaaaaaaaaaaalkfsbba
Similar Messages
-
Hi,
I am using PHP4.4 and Oracle 10g for my research work. I defined 'protein_seq' field as CLOB in a table. I uploaded data into it using sqlloader.
Now, I want to display the value of that field based on user requirements. When i did like this, I am getting 'Object' as value instead of original value.
$s4 = OCIParse($conn, "select * from protein_uniprot where uniprot_id LIKE '$protein%'");
OCIExecute($s4, OCI_DEFAULT);
while (OCIFetch($s4)) {
$proteinseq = OCIResult($s4, "PROTEIN_SEQ");
echo $proteinseq;
Could you please help me how to fetch CLOB data from oracle table using PHP.
Thanks,
Rani.convert the lob column to varchar2. Use [dbms_lob |http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#BABEEAAH] package to convert
select dbms_lob.SUBSTR(column,2000,1) from table- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Query for select CLOB data field
Hi All,
I want to know how to write a SQL query for select CLOB tyoe data from a tablw. when I am trying to use the simple SQL it gives an messageLOB types requires OCI8 mode and currently uasing OCI7 ode.
Also I am not aware of oci mode?
If its working for OCI8 mode how I should changer it in to OCI8 mode? (I am using 10g rel 2)
Thans and regards
BuddhikeHi ,
i don't want to use loop (sy-tabix) ..
any particular reason for this ?
as u cannot automatically generate serial number, u have to go for loop....endloop.
Thanks
Karthik -
Error selecting CLOB data from Oracle DB
I am using CRXI with an Oracle 10g database.
Recently, some columns were changed from Data Type LONG to CLOB. Now, I get 2 error messages when trying to select any of these columns: 'Failed to retrieve data from the database' and 'Database connector error: cannot obtain error message from server'.
I am using the Microsoft ODBC for Oracle. Is there some other ODBC which can select this data type?MS's ODBC driver for Oracle only supports Oracle 7, it's noted on MS's MSDN site.
Use Oracles ODBC Driver or Data Direct that ships with CR.
Don -
How can you SELECT via Database Link CLOB data using Application Express?
Customer Issue:
Developer using Oracle's Application Express 3.1. The Developer is trying to SELECT a CLOB datatype column from a remote (10.2.0.3) database, via a database link on her 10.2.0.4 based client Application. The Developer wants to be able to select CLOB data from the remote database which has limitation that she can't make any changes to the remote database.
Developer's Comments:
I do a select and get the error. Getting error ORA-22992: cannot use LOB locators selected from remote tables. So she feels she can't use dbms_lob.substr in this configuration I can do a "select into" but that is for one value. I am trying to run a select statement for a report that brings back more than one row. I do not have permission to change anything on the remote database. I want to access the remote database and multiple tables.
This is not something I work with, would greatly appreciate help or ideas. Is this a limitation of the 3.1; or does she just not have this set up correctly; or should she be using a Collection (if yes, please share example)
Thanks very much,
Pam
Edited by: pmoutrie on Jun 4, 2009 12:01 PM
Hello???
Would really appreciate an answer.
Thanks,
PamThis may not be a perfect solution for you but it worked for my situation.
I wanted to grab some data from Grid Control's MGMT$JOB_STEP_HISTORY table but I couldnt' create an Interactive Report due to the existance of a CLOB column. I cheated this by creating a view on the GC DB, grabbing the first 4000 characters and turning it into a varchar2 column:
create view test_job_step_history as
select job_Name, target_name, status, start_time, end_time, to_char(substr(output,1,4000)) output
from MGMT$JOB_STEP_HISTORY where trunc(end_time) > trunc(sysdate)-90
In an APEX Interactive Report:
select * from test_job_step_history@GCDB
Granted, the output looks aweful right now but I am only looking for a very particular output (failed, denied, ORA-, RMAN-, etc) so the formatting isn't the most important thing to me right now.
If anyone can improve -- and I'm sure you can -- on this I'd love to hear about it.
Thanks,
Rich -
Error in selection of clob data
Hello Everyone
I am running a select on a hana table which contains clob data. But i receive some notification regrading persistence
Could not complete result operation. SAP DBTech JDBC: [21]: persistence error: exception 70029020: ltt::exception caught while operating on DISK_NCLOB:2:1090921698160exception 1000002: Allocation failed ; $size$=10485760; $name$=PersistenceLayer; $type$=pool; $inuse_count$=6580; $allocated_size$=5444213184 at function __copy__()
Does anyone have any idea to tackle this issue?
Thanks in Advance
Best Regards
VivekHi Vivek,
It seems a memory issue while fetching the information - Allocation failed ; $size$=10485760; $name$=PersistenceLayer; $type$=pool; $inuse_count$=6580; $allocated_size$=5444213184
I would suggest:
1. To fetch a small set of information, if the the current is very large, to ensure it is indeed a memory issue.
2. If it is a memory issue, memory parameters in the Administration Console will need to be changed.
Let me know.
Regards,
kG -
Can not Load CLOB data 32k to target table
SQL> DESC testmon1 ;
Name Null? Type
FILENAME VARCHAR2(200)
SCANSTARTTIME VARCHAR2(50)
SCANENDTIME VARCHAR2(50)
JOBID VARCHAR2(50)
SCANNAME VARCHAR2(200)
SCANTYPE VARCHAR2(200)
FAULTLINEID VARCHAR2(50)
RISK VARCHAR2(5)
VULNNAME VARCHAR2(2000)
CVE VARCHAR2(200)
DESCRIPTION CLOB
OBSERVATION CLOB
RECOMMENDATION CLOB
SQL> DESC test_target;
Name Null? Type
LOCALID NOT NULL NUMBER
DESCRIPTION NOT NULL CLOB
SCANTYPE NOT NULL VARCHAR2(12)
RISK NOT NULL VARCHAR2(6)
TIMESTAMP NOT NULL DATE
VULNERABILITY_NAME NOT NULL VARCHAR2(2000)
CVE_ID VARCHAR2(200)
BUGTRAQ_ID VARCHAR2(200)
ORIGINAL VARCHAR2(50)
RECOMMEND CLOB
VERSION VARCHAR2(15)
FAMILY VARCHAR2(15)
XREF VARCHAR2(15)
create or replace PROCEDURE proc1 AS
CURSOR C1 IS
SELECT FAULTLINEID,VULNNAME,scanstarttime, risk,
dbms_lob.substr(DESCRIPTION,dbms_lob.getlength(DESCRIPTION),1) "DESCR",dbms_lob.substr(OBSERVATION,dbms_lob.getlength(OBSERVATION),1) "OBS",
dbms_lob.substr(RECOMMENDATION) "REC",CVE
FROM testmon1;
c_rec C1%ROWTYPE;
descobs clob;
FSCAN_VULN_TRANS_REC VULN_TRANSFORM_STG%ROWTYPE;
TIMESTAMP varchar2(50);
riskval varchar2(10);
pCTX PLOG.LOG_CTX := PLOG.init (pSECTION => 'foundscanVuln Procedure',
pLEVEL => PLOG.LDEBUG,
pLOG4J => TRUE,
pLOGTABLE => TRUE,
pOUT_TRANS => TRUE,
pALERT => TRUE,
pTRACE => TRUE,
pDBMS_OUTPUT => TRUE);
amount number;
buffer varchar2(32000);
BEGIN
---INITIALIZE THE LOCATOR FOR CLOB DATA TYPE
select observation into descobs from testmon1 where rownum=1;
OPEN C1;
loop
fetch C1 INTO c_rec;
exit when C1%NOTFOUND;
--LOAD THE DESCRIPTION FIELD FROM CURSOR AND WRITE IT TO THE CLOB LOCATOR descobs.
dbms_lob.Write(descobs,dbms_lob(c_rec.DESCR),1,c_rec.DESCR);
------APPEND THE OBSERVATION FIELD FROM CURSOR TO THE CLOB LOCATOR descobs.
dbms_lob.Writeappend(descobs,dbms_lob(c_rec.DESCR),c_rec.OBS);
-- dbms_output.put_line ('the timestamp is :'||c_rec.scanstarttime);
--dbms_lob.write(descobs,amount,1,buffer);
descobs:=c_rec.OBS;
--dbms_lob.read(descobs,amount,1,buffer);
--dbms_lob.append(c_rec.DESCR,c_rec.OBS);
--descobs:=c_rec.OBS;
--dbms_output.put_line ('the ADDED DESCROBS is :'||dbms_lob.substr(c_rec.DESCR,dbms_lob.getlength(c_rec.DESCR),1));
dbms_output.put_line ('the ADDED DESCRIPTION AND OBSERVATION is :'||descobs);
--dbms_output.put_line ('the DESCROBS buffer is :'||buffer);
SELECT DESCRIPTION INTO FSCAN_VULN_TRANS_REC.DESCRIPTION
FROM TESTMON1 WHERE ROWNUM=1;
---------LOAD THE DESCRIPTION+ observation value into the target table description
DBMS_LOB.WRITE(FSCAN_VULN_TRANS_REC.DESCRIPTION, dbms_lob.getlength(descobs),1,descobs);
TIMESTAMP:=substr(c_rec.scanstarttime,1,10)||' '|| substr(c_rec.scanstarttime,12,8);
IF c_rec.risk <3
THEN riskval:='Low';
ELSIF c_rec.risk <6
THEN riskval:='Medium';
ELSIF c_rec.risk <10
THEN riskval:='High';
END IF;
FSCAN_VULN_TRANS_REC.TIMESTAMP:=TO_DATE(TIMESTAMP, 'YYYY/MM/DD HH24:MI:SS');
FSCAN_VULN_TRANS_REC.risk:= riskval;
--dbms_lob.append(c_rec.DESCR,c_rec.OBS);
FSCAN_VULN_TRANS_REC.DESCRIPTION:=c_rec.DESCR;
FSCAN_VULN_TRANS_REC.RECOMMEND:=c_rec.REC;
FSCAN_VULN_TRANS_REC.LocalID:=to_number(c_rec.FAULTLINEID);
FSCAN_VULN_TRANS_REC.SCANTYPE:='FOUNDSCAN';
FSCAN_VULN_TRANS_REC.CVE_ID:=c_rec.CVE;
FSCAN_VULN_TRANS_REC.VULNERABILITY_NAME:=c_rec.VULNNAME;
-- dbms_output.put_line ('the plog timestamp is :'||timestamp);
-- dbms_output.put_line ('the timestamp is :'||riskval);
--dbms_output.put_line ('the recommend is :'||FSCAN_VULN_TRANS_REC.RECOMMEND);
--dbms_output.put_line ('the app desc is :'||FSCAN_VULN_TRANS_REC.DESCRIPTION);
insert into test_target values FSCAN_VULN_TRANS_REC;
End loop;
close C1;
commit;
EXCEPTION
WHEN OTHERS THEN
-- dbms_output.put_line ('Data not found');
-----------dbms_output.put_line (sqlcode|| ':'||sqlerrm);
end proc1;
using dbms_lob package is not helping. Either DB stops responding. Or the Observation field ( which has max length >300000) can not be loaed into a CLOB variable.
Please help or give me a sample code that helps.select
BANKING_INSTITUTION.BANK_REF_CODE C1_BANK_ID,
BANKING_INSTITUTION.NAME_BANK C2_BANK_NAME,
BANKING_INSTITUTION.BANK_NUMBER C3_BANK_NUMBER,
BANKING_INSTITUTION.ISO_CODE C4_GBA_CODE,
BANKING_INSTITUTION.STATUS C5_STATUS,
BANKING_INSTITUTION.SOURCE C6_SOURCE,
BANKING_INSTITUTION.START_DATE_BANK C7_START_DATE,
BANKING_INSTITUTION.ADDRESS_BANK C8_BANK_ADDRESS1
from REF_DATA_DB.BANKING_INSTITUTION BANKING_INSTITUTION
where (1=1)
insert /*+ append */ into XXSVB.C$_0XXSVB_BANKS_STAGING
C1_BANK_ID,
C2_BANK_NAME,
C3_BANK_NUMBER,
C4_GBA_CODE,
C5_STATUS,
C6_SOURCE,
C7_START_DATE,
C8_BANK_ADDRESS1
values
:C1_BANK_ID,
:C2_BANK_NAME,
:C3_BANK_NUMBER,
:C4_GBA_CODE,
:C5_STATUS,
:C6_SOURCE,
:C7_START_DATE,
:C8_BANK_ADDRESS1
) -
Problem in using CLOB Data from a Data and exporting into File
Hi,
UTL_FILE Error Occured while using UTL_FILE with CLOB Data.
UTL_FILE: A write error occurred.
The Below Code is for reference:
DECLARE
C_AMOUNT CONSTANT BINARY_INTEGER := 32767;
L_BUFFER VARCHAR2(32767);
L_CHR10 PLS_INTEGER;
L_CLOBLEN PLS_INTEGER;
L_FHANDLER UTL_FILE.FILE_TYPE;
L_POS PLS_INTEGER := 1;
BEGIN
FILE_NAME:=UTL_FILE.FOPEN('EXPORT_DIR','EXPORT_FILE'||'.sql','W');
FOR C1_EXP IN (SELECT INSERT_STRING FROM EXPORTED_DUMP) LOOP
L_CLOBLEN := DBMS_LOB.GETLENGTH(C1_EXP.INSERT_STRING);
DBMS_OUTPUT.PUT_LINE('THE CLOB LEN '||L_CLOBLEN);
DBMS_OUTPUT.PUT_LINE('THE POSITION '||L_POS);
WHILE L_POS < L_CLOBLEN LOOP
L_BUFFER := DBMS_LOB.SUBSTR(C1_EXP.INSERT_STRING, C_AMOUNT, L_POS);
DBMS_OUTPUT.PUT_LINE('THE BUFFER IS '||L_BUFFER);
EXIT WHEN L_BUFFER IS NULL;
UTL_FILE.PUT_LINE(FILE_NAME, C1_EXP.INSERT_STRING);
L_POS := L_POS + LEAST(LENGTH(L_BUFFER)+1,c_amount);
END LOOP;
END LOOP;
UTL_FILE.FCLOSE(FILE_NAME);
EXCEPTION
WHEN UTL_FILE.INTERNAL_ERROR THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An internal error occurred.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: The file handle was invalid.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.INVALID_MODE THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid open mode was given.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.INVALID_OPERATION THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid operation was attempted.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid path was give for the file.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.READ_ERROR THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A read error occurred.');
UTL_FILE.FCLOSE_ALL;
WHEN UTL_FILE.WRITE_ERROR THEN
DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A write error occurred.');
UTL_FILE.FCLOSE_ALL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Some other error occurred.');
UTL_FILE.FCLOSE_ALL;
END;Hi user598986!
OK, I understood that there is a problem with your code. But please would you be so kindly to tell us here what error exactly happens (the errormessage). Mabay after that someone will be able to help you.
yours sincerely
Florian W.
P.S. If you enclose your code into tags it will be shown formated. -
Problem in spooling the clob data to Excel sheet
Hi dev's
currently i am using below version :
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production here is my DDL ststements :
CREATE TABLE tt1 (n1 number,c1 varchar2(1),b1 clob);I inserted one record in tt1 table like :
INSERT INTO tt1 values (1,'a',aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);length of clob data in b1 column is
SELECT DBMS_LOB.GETLENGTH(b1) FROM tt1 WHERE n1 =1;
1432
1 rows selected What's my problem is :
i am correctly spooling the data into .xls file But
The Clob data is placed into sperate lines(cells). I need the CLOB (b1 column data) data INTO single ROW (cell)
i am able to get the n1,c1 data into seperate cells.
below is the excel sheet data (the space between rows are seperate lines):
number_value character_value clob_value
1 a gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Please help me on this issue.
Thanks,You may need to put double quotes around your CSV string data, so that Excel can recognise it as single values rather than trying to split it across cells/rows.
For example a nicely formed CSV may look like:
empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10where the string data has double quotes around it. This also means that comma values within the quotes will not be treated as a new value, but rather as part of the text itself. -
Error when Converts rows to columns dynamically in clob data type
Hi
I am using below pl/sql statement
SELECT NO,
MAX (DECODE (NAME, 'A', VALUE1, NULL)) AS A,
MAX (DECODE (NAME, 'B', VALUE1, NULL)) AS B,
MAX (DECODE (NAME, 'C, VALUE1, NULL)) AS C,
MAX (DECODE (NAME, 'D', VALUE1, NULL)) AS D
FROM ( SELECT NO,
RTRIM (
XMLAGG (XMLELEMENT (E, VALUE || ',')).EXTRACT ('//text()').
GETCLOBVAL (),
VALUE1,
NAME
FROM DA
while i am execute for varchar type its as i expected. when i tried with clob data type i am getting follwoing error.
ORA-00932: inconsistent datatypes: expected - got CLOB
can any one pleas me?
thanks
Nagarajan.VNagarajan Venu wrote:
Thanks for your reply
This is scenario.
This is my table
NO--name--value
1--A--ASDF
2--B--IOP
all columns are clob type and i want the output like below.
No--A
1--ASDF
2--IOP
i just want to convert all rows to coulmns(clob type) dynamically.I don't get how you got that output from the data? What happened to "B"?
Please post a suitable example and expected output using create table and insert statements as well as giving your database version and using {noformat}{noformat} tags as detailed in the FAQ: {message:id=9360002} -
Need to select XMLTYPE data in unindented form, from a query.
I need to select XMLTYPE data among relational data as an xml element.
SELECT
XMLSERIALIZE(DOCUMENT
XMLELEMENT ("Account",
XMLATTRIBUTES (LPAD(ROWNUM, 10 , '0') AS "recordId" )
,XMLELEMENT ("Header"
,XMLELEMENT ("AccountId"
,XMLELEMENT ("AccountNumber" ,car.acc_nbr )))
,XMLELEMENT ("CreditPurpose" ,car.credit_purp )
,XMLELEMENT ("AccountType" ,car.acc_type )
, (cdx.cus_dtls) -- /*THIS IS XMLTYPE data*/
))AS crdtrpt
FROM cus_acc_rpt car , cus_dtls_xml cdx
WHERE car.ar_id = cdx.ar_id
Here cdx.cus_dtls need to be selected in unindented form (each records as a long unbroken string of data). So that I can SPOOL huge number of records in lesser time.
I am trying to convert this into CLOB and Insert into CLOB type column of a table.
But XMLSERIALIZE does not seem to serialize the xml data in cus_Dtls column.
However it does serialize the xml typ data selected other than cus_dtls.
Any quick hints to meet the requirements will be very welcomed !!
Cheers !!
SaxenaUse XMLSerialize with NO INDENT option :
SELECT XMLSERIALIZE(DOCUMENT
XMLELEMENT ("Account",
NO INDENT
)AS crdtrpt
FROM cus_acc_rpt car , cus_dtls_xml cdx
WHERE car.ar_id = cdx.ar_id -
How to view clob data using sql
Hi,
In our database, we have one table that is having one column of CLOB datatype but now i want to view the data using sql select query but it throws error: "Datatype not supported".
Could any one please let me know how to view the clob data using select query.
Oracle DB version : 10.2.0.3
Thanksh5.
use read procedure
PROCEDURE READ (
lobsrc IN BFILE|BLOB|CLOB ,
amount IN OUT BINARY_INTEGER,
offset IN INTEGER,
buffer OUT RAW|VARCHAR2 );
example Updating LOB by Using DBMS_LOB in PL/SQL
DECLARE
lobloc CLOB; -- serves as the LOB locator
text VARCHAR2(32767):='Resigned: 5 August 2000';
amount NUMBER ; -- amount to be written
offset INTEGER; -- where to start writing
BEGIN
SELECT resume INTO lobloc
FROM employees
WHERE employee_id = 405 FOR UPDATE;
offset := DBMS_LOB.GETLENGTH(lobloc) + 2;
amount := length(text);
DBMS_LOB.WRITE (lobloc, amount, offset, text );
text := ' Resigned: 30 September 2000';
SELECT resume INTO lobloc
FROM employees
WHERE employee_id = 170 FOR UPDATE;
amount := length(text);
DBMS_LOB.WRITEAPPEND(lobloc, amount, text);
COMMIT;
END; -
Hi,
We have a table in our oracle database having CLOB datatype as column.This column gets populated from Java application wherein the application reads an excel file from front end into CLOB column.
My requirement is to read this CLOB column from database and insert data into some file(CSV Format). say if excel was read into CLOB with 3 column and 10 rows, then I should also be able to read this column and insert into some file(CSV Format) that has same structure as of excel file.
For this i call the JavaConcurrentProgram.
Can anyone tell me what will i do for this? Any help would be appreciated.
Thanks in advanceHi chandra,
Thanks for ur reply.
I create the EO and VO for file uploading.
I want to upload the file into data base when i clicked on the submit button.So i write the row creation code in PFR.
Actually my requirement is: whenever we upload the file into database(CLOB cloumn) by using the javaconcurrentprogram we convert the clob data content is stroed in .dat file certain path.
for this i write the code like this:
Actuall class+:*
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("go") != null)
{ processFileUpload(pageContext, webBean, am);
protected void processFileUpload(OAPageContext pageContext, OAWebBean webBean, OAApplicationModule am)
// Get hold of the binary fle contents
DataObject fleUploadData = (DataObject)pageContext.getNamedDataObject("fileupload");
if (fleUploadData == null) return;
String fleName = (String)fleUploadData.selectValue(null,"UPLOAD_FILE_NAME");
if (fleName == null) return;
String contentType =(String)fleUploadData.selectValue(null,"UPLOAD_FILE_MIME_TYPE");
BlobDomain uploadedByteStream = (BlobDomain)fleUploadData.selectValue(null,fleName);
if (uploadedByteStream == null) return;
// convert binary fle contents into an ASCII stream
System.out.println("after calling if block");
try {
String inputStream = streamToString(contentType, uploadedByteStream.getInputStream() );
String purposeCode = null;
System.out.println("after calling if block");
System.out.println("store the values in table");
// Store ASCII in the fle in the database
primaryKey = storeStream(inputStream , purposeCode, am);
System.out.println("after calling if block");
System.out.println("the orgid value iss "+(am.getOADBTransaction()).getOrgId());
int orgId = ((OADBTransactionImpl)am.getOADBTransaction()).getOrgId();
// submit the printing request
submitConcurrentProgram(primaryKey, purposeCode, orgId, am.getOADBTransaction().getJdbcConnection());
} catch (IOException ex) {
throw OAException.wrapperException(ex);
} catch (SQLException ex) {
throw OAException.wrapperException(ex);
} catch (RequestSubmissionException ex) {
throw OAException.wrapperException(ex);
protected String streamToString(String mimeType, InputStream inputStream) throws IOException
String result;
System.out.println("mime type is "+mimeType);
// check if this is an Excel spreadsheet
if ("application/vnd.ms-excel".equalsIgnoreCase(mimeType))
try {
result = xlsToString(inputStream);
} catch (jxl.read.biff.BiffException ex)
{ // if not, then assume this is an ASCII stream
System.out.println("catch blockk");
inputStream.reset();
result = inputStream.toString();//streamToString(mimeType,inputStream); ////streamToString("ASCII",inputStream);
} else
{ // otherwise an ASCII stream
result =inputStream.toString();//streamToString(mimeType,inputStream); ////streamToString("ASCII",inputStream);
return result;
private final static String CSV_SEPARATOR = ",";
private String xlsToString(InputStream stream)
throws jxl.read.biff.BiffException
StringWriter stringWriter = new StringWriter();
BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
try {
WorkbookSettings ws = new WorkbookSettings();
ws.setLocale(new Locale("en", "EN"));
Workbook w = Workbook.getWorkbook(stream, ws);
// Gets the sheets from workbook
for (int sheet = 0; sheet < w.getNumberOfSheets(); sheet++)
Sheet s = w.getSheet(sheet);
Cell[] row = null;
// Gets the cells from sheet
for (int i = 0 ; i < s.getRows() ; i++)
row = s.getRow(i);
if (row.length > 0)
bufferedWriter.write(formatExcelCell(row[0]));
for (int j = 1; j < row.length; j++)
bufferedWriter.write(CSV_SEPARATOR);
bufferedWriter.write(formatExcelCell(row[j]));
bufferedWriter.newLine();
bufferedWriter.flush();
catch(jxl.read.biff.BiffException ex)
throw ex;
catch (Exception ex)
throw OAException.wrapperException(ex);
return stringWriter.toString();
private final static String QUOTE_STRING ="\"";
private String formatExcelCell(Cell cell)
SimpleDateFormat dateFormatter = new SimpleDateFormat("d-MMM-yyyy");
if (cell == null) return null;
String rowCell = cell.getContents();
// format the date
if ( cell.getType().equals(cell.getType().DATE) )
rowCell = dateFormatter.format(((DateCell)cell).getDate());
// double each quote
String result = rowCell.replaceAll(QUOTE_STRING, QUOTE_STRING+QUOTE_STRING);
// surround with quotes if comma or quote is present
if (result.indexOf(CSV_SEPARATOR) >0 || result.indexOf(QUOTE_STRING) >0)
result = QUOTE_STRING + result + QUOTE_STRING;
return result;
protected Number generatePrimaryKey(OAApplicationModule am)
OAViewObject viewObject = (OAViewObject)am.findViewObject("FileUploadKeyVO1");
viewObject.setMaxFetchSize(1);
viewObject.executeQuery();
return (Number) (viewObject.first().getAttribute("Id"));
*public Number storeStream*(String inputStream, String purposeCode,OAApplicationModule am)
OAViewObject viewObject = (OAViewObject)am.findViewObject("xxcrmFileUploadVO1");
viewObject.setMaxFetchSize(0);
ClobDomain myClob = new ClobDomain();
myClob.setChars(inputStream.toCharArray());
OARow row = (OARow)viewObject.createRow();
row.setAttribute("FileContents",myClob);
primaryKey = generatePrimaryKey(am);
row.setAttribute("PurposeCode", purposeCode);
row.setAttribute("FileId", primaryKey);
viewObject.insertRow(row);
am.getTransaction().commit();
return primaryKey;
public void runProgram(CpContext cpcontext) {
try {
// read parameters
// execute business logic
cpcontext.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
} catch (Exception ex) {
// report exception
cpcontext.getReqCompletion().setCompletion(ReqCompletion.ERROR, "Error building output fle");
} finally {
cpcontext.releaseJDBCConnection();
static public Map convertParameters(ParameterList parameterList)
{ Map result = new HashMap();
while( parameterList.hasMoreElements() ) {
NameValueType nameValueType = parameterList.nextParameter();
if (nameValueType.getValue() != null)
result.put(nameValueType.getName(), nameValueType.getValue());
return result;
protected void submitConcurrentProgram(Number primaryKey, String purposeCode, int orgId,
Connection connection) throws IOException, SQLException, RequestSubmissionException
System.out.println("before getting the output");
System.out.println("after getting the output");
ConcurrentRequest request = new ConcurrentRequest(connection);
Vector param = new Vector();
param.add(primaryKey.stringValue());
param.add(purposeCode);
param.add(String.valueOf(orgId));
int reqId = request.submitRequest("XXNC", "XXNC_FILEWRITE_JAVA", "Print CLOB",null, false, param);
connection.commit();
MessageToken[] tokens = { new MessageToken("REQUEST", String.valueOf(reqId)) };
OAException confrmMessage = new OAException("XXNC",
"XXNC_TEST_MSG",
tokens,
OAException.CONFIRMATION,
null);
throw confrmMessage;
_+*JavaconcurrentProgram class:*+_
/* for getting the clob data content stored into certain path*/
public String getOutput(Connection connection,
BigDecimal primaryKey) throws SQLException,
IOException
String statement =
"select file_contents from xxcrm_file_upload where file_id = :1";
String result;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try
stmt = connection.prepareStatement(statement);
stmt.setBigDecimal(1, primaryKey);
resultSet = stmt.executeQuery();
resultSet.next();
result = //streamToString("application/vnd.ms-excel",resultSet.getAsciiStream(1));
resultSet.getAsciiStream(1).toString(); //streamToString("ASCII",resultSet.getAsciiStream(1) );
File data = new File("/u01/VIS/apps/apps_st/appl/xxnc/12.0.0/bin/TestClob.dat");
Reader reader = resultSet.getCharacterStream(1);
FileWriter writer = new FileWriter(data);
char[] buffer = new char[1];
while (reader.read(buffer) > 0) {
writer.write(buffer);
writer.close();
resultSet.close();
resultSet = null;
stmt.close();
stmt = null;
} finally
if (resultSet != null)
try
resultSet.close();
} catch (SQLException ex)
if (stmt != null)
try
stmt.close();
} catch (SQLException ex)
try
connection.commit();
} catch (SQLException ex)
return result;
public void runProgram(CpContext cpcontext)
Number primarykey = 0;
String s = cpcontext.getProfileStore().getProfile("APPS_FRAMEWORK_AGENT");
if (!s.endsWith("/"))
s = (new StringBuilder()).append(s).append("/").toString();
s = (new StringBuilder()).append(s).append("OA_MEDIA").toString();
Connection con = cpcontext.getJDBCConnection();
ReqCompletion lRC = cpcontext.getReqCompletion();
try
// Connection con = DriverManager.getConnection("jdbc:oracle:thin:@erpdb.nalsoft.net:1521:VIS","apps","visdb_234");
PreparedStatement st =
con.prepareStatement("select file_id from xxcrm_file_upload order by file_id desc");
ResultSet rs = st.executeQuery();
OutFile lOF = cpcontext.getOutFile();
LogFile lLF = cpcontext.getLogFile();
if (rs.next())
primarykey = rs.getBigDecimal(1);
BigDecimal primarybig = new BigDecimal(primarykey.toString());
s = getOutput(con, primarybig);
lOF.write(s);
lRC.setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
} catch (Exception e)
{ //Catch exception if any
System.err.println("Error: " + e.getMessage());
lRC.setCompletion(ReqCompletion.ERROR, e.toString());
} finally
cpcontext.releaseJDBCConnection();
Please give me the suggestion. -
Error in calling CLOB data.. Error parsing envelope:
Hi,
I have database table with some CLOB data type columns.
using DB adpater (simple select query using), I am selecting that talbe. I am getting the following error :
Your test request generated the following exception/fault:
Could not initiate the BPEL process because the input xml is not well formed, the reason is :
Error parsing envelope: (1, 223) Invalid char in text. Please correct the input xml.
How to read the CLOB data from DB that and assigs back to output varaiable in BPEL.
Thanks,
BharathHi,
You want to upload file by TCP on RT target, but TCP/IP is not deterministic, so you have an timeout error.
Have a look on this :TCP/IP Communication Error -56 When Communicating to an RT System
Regards,
Aurélien J.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> Du 30 juin au 25 août, embarquez pour 2 mois de vidéo-t'chat ! Prenez place pour un voyage au coe... -
Loading clob data/Migrating from Informix
Hi,
I wanted to understand a way to insert clob data into the database. I see that you have ways of retrieving and displaying the clobs/blobs in your demo programs. But, how do we go about inserting clob data into a column? And especially, How to accomplish this when the data is stored in the form of a file?
We're in the process of migrating from Informix to Oracle and Informix has this way of storing the clob contents into .EMB files. Moreover, there is no one-to-one correspondence between each clob column and an .EMB file. Informix just knows how to load them up when you use FILETOCLOB(). In similar lines, do we have a way to load clob data from files to start with. And would be glad to get some intricacies on achieving the migration of data from Informix database.
Please send me pointers to docs and procedures, if available.
Thanks for your time
Chandra M.You can see this sample:
/******* schema ********
create table city
(id integer ,
cimg blob DEFAULT NULL
#include <iostream>
#include <fstream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
#define BUFSIZE 8192
Environment *env;
Connection *conn;
int res=0;
unsigned int offsetw=1;
unsigned char readbuf[BUFSIZE];
main()
try {
env = Environment::createEnvironment();
conn = env->createConnection("scott","tiger");
catch(SQLException &x)
cout << "Error :" << x.what() <<"\n";
return 1;
try
ifstream infile ("bangalore.jpg", ios::binary);
if (!infile.is_open()) cout << "could not open bangalore.jpg\n";
else
Statement *stmt = conn->createStatement();
stmt->setSQL( "INSERT INTO city VALUES(1, EMPTY_BLOB())");
stmt->execute();
stmt->setSQL("SELECT cimg from city where id = 1");
stmt->execute();
ResultSet *rs= stmt->getResultSet();
rs->next();
Blob blob(conn);
blob = rs->getBlob(1);
blob.open();
do
infile.read((char *)readbuf,BUFSIZE);
res=infile.gcount();
if (!res) break;
blob.writeChunk(res,readbuf, BUFSIZE, offsetw);
offsetw+=res;
} while (1);
infile.close();
blob.close();
conn->commit();
catch(SQLException &x)
cout << "Error :" << x.what() <<"\n";
try{
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
catch(SQLException &x)
cout << "Error :" << x.what() <<"\n";
} /* end of main */
Maybe you are looking for
-
What is the best forum for "hard" questions ?
Hi, First let me say this is a great forum for flex questions... But, I'm working on some "unusual" problems and my questions don't get answered. I think I may not be on the correct forum. Any suggestions on another forum to address the more complex
-
I'm struggling with how to make a check mark ( image ) show up or not based on the value of some data in each datagrid line item. I'm using an item renderer but I'm missing something. Any help would be greatly appreciated. thanks, STeveR
-
I try downloading the ios7 and it keeps saying there is an error
Everytime I try downloading it says error occurred check setting but there's nothing wrong with any of my settings
-
Hello, While doing MIGO system showing error " No account was specified for account type "D" in item "0000000001" Kindly help me to resolve this issue. Regards, Abhijit
-
Sync with second user outlook contact lists?
I have an enterprise user that would like to sync his iPhone with his administrative assistant's Outlook contact lists. Is there a way to accomplish this?