CLOB field in condition
I have a table Provision cositng of 2 fields:
PROV_ID Number(10)
PROV_TEXT CLOB
I need to create workbook/query in Discoverer like
select PROV_ID, PROV_TEXT from provision wherer PROV_TEXT like '%a%'
it works perfect in SQL PLUS but Discoverer PLUS gives me error with the following text:
"You can't use a Long type item in a filter".
Is it just restriction our discoverer version? If not what workarounds can be implemented to give our users to query CLOB fields through Discoverer?
We run the following versions:
Oracle Application Server Discoverer 10g (9.0.4.00.00)
Oracle Application Server Discoverer Plus 10g (9.0.4.45.04)
Discoverer Model - 9.0.4.45.04
Discoverer Server - 9.0.4.45.03
End User Layer - 5.0.2.0.0.0
End User Layer Library - 9.0.4.45.03
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
Thanks for any advices
I have a table Provision cositng of 2 fields:
PROV_ID Number(10)
PROV_TEXT CLOB
I need to create workbook/query in Discoverer like
select PROV_ID, PROV_TEXT from provision wherer PROV_TEXT like '%a%'
it works perfect in SQL PLUS but Discoverer PLUS gives me error with the following text:
"You can't use a Long type item in a filter".
Is it just restriction our discoverer version? If not what workarounds can be implemented to give our users to query CLOB fields through Discoverer?
We run the following versions:
Oracle Application Server Discoverer 10g (9.0.4.00.00)
Oracle Application Server Discoverer Plus 10g (9.0.4.45.04)
Discoverer Model - 9.0.4.45.04
Discoverer Server - 9.0.4.45.03
End User Layer - 5.0.2.0.0.0
End User Layer Library - 9.0.4.45.03
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
Thanks for any advices
Similar Messages
-
Extracting xmldata from clob field in oracle
I have an xml document stored in xmltype (clob)field in oracle
Below is the xml data inside the xml ( I have kind of 300 elements similar to this inside the xml)
<ns1:E-I12_IS_13 ObjID="I12" ObjType="e">5437090</ns1:E-I12_IS_13>
<ns1:E-I13_IS_14 ObjID="I13" ObjType="e">5</ns1:E-I13_IS_14>
<ns1:E-I14_IS_15 ObjID="I14" ObjType="e">9</ns1:E-I14_IS_15>
The requirement is to get all the elements from the xmldata and compare against the 15-16 oracle tables ( here xml is converted and stored in these tables by a tibco process)
select dbms_lob.instr(clobcolumnname,'E-I13_IS_14') from tablename where ( given condition to extract specific transaction)
the above statement gives me position of the string
select dbms_lob.substr(clobcolumnname,6( length of element value),870(position from where the value starts)) from tablename where condition
the abv statement gives me the element value
but I want to extract the value for any element by giving the element name ( if u see any value comes after objtype="e" between > and < tags)
can anyone on this forum tell me to extract the element value just by giving element name ( since I have to do the same for n number of elements - how to find position of > and < tags??)Hi Odie,
Good afternoon. I am not getting any help to solve my xmltable issues.
<MeterTransaction xmlns:CorralClub="http://webservice.hlsr.net/CorralClubService/">
<TransactionID>1100</TransactionID>
<Club_Number>CN001</Club_Number>
<Club_Activity_ID>0</Club_Activity_ID>
<Transaction_Date>2014-01-29T00:00:00-06:00</Transaction_Date>
<Creation_Date>2014-01-29T00:00:00-06:00</Creation_Date>
<User_ID>1766</User_ID>
<Status />
<TicketCount>0</TicketCount>
<Usage>0</Usage>
<BadPulls>0</BadPulls>
<Discrepancy>0</Discrepancy>
<Percent>0</Percent>
<Comments />
<Readings>
********** Can be disregarded ******************
<xs:schema id="ClubMeter" targetNamespace="http://tempuri.org/ClubMeter.xsd" xmlns:mstns="http://tempuri.org/ClubMeter.xsd" xmlns="http://tempuri.org/ClubMeter.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft- com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
****** Some other elements
</xs:schema>
*********** End of Can be disregarded ******************
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<ClubMeter xmlns="http://tempuri.org/ClubMeter.xsd">
<MeterBar diffgr:id="MeterBar1" msdata:rowOrder="0" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS01</Bar_Number>
<TicketCount>111</TicketCount>
<Usage>88</Usage>
<BadPulls>15</BadPulls>
<Discrepancy>8</Discrepancy>
<Percent>0.0720720720720721</Percent>
<DISPLAY>BEER - BBS01</DISPLAY>
</MeterBar>
<MeterBar diffgr:id="MeterBar2" msdata:rowOrder="1" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS02</Bar_Number>
<DISPLAY>BEER - BBS02</DISPLAY>
</MeterBar>
<MeterReading diffgr:id="MeterReading16" msdata:rowOrder="15" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS01</Bar_Number>
<Position>11</Position>
<Inventory_Item_ID>12906</Inventory_Item_ID>
<Product_Class>SOFT-GOODS</Product_Class>
<Product_Type>SOFT DRINK</Product_Type>
<Product_Name>Full Throttle Coca Cola</Product_Name>
<Open>6</Open>
<Add1>11</Add1>
<Close>1</Close>
<Usage>16</Usage>
</MeterReading>
<MeterReading diffgr:id="MeterReading96" msdata:rowOrder="95" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS01</Bar_Number>
<Position>10</Position>
<Inventory_Item_ID>2188</Inventory_Item_ID>
<Product_Class>BEER</Product_Class>
<Product_Type>DOMESTIC</Product_Type>
<Product_Name>Lone Star Regular</Product_Name>
<Open>6</Open>
<Add1>2</Add1>
<Close>1</Close>
<BadPulls>3</BadPulls>
<Usage>4</Usage>
</MeterReading>
<MeterReading diffgr:id="MeterReading17" msdata:rowOrder="16" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS02</Bar_Number>
<Position>11</Position>
<Inventory_Item_ID>12906</Inventory_Item_ID>
<Product_Class>SOFT-GOODS</Product_Class>
<Product_Type>SOFT DRINK</Product_Type>
<Product_Name>Full Throttle Coca Cola</Product_Name>
</MeterReading>
<MeterReading diffgr:id="MeterReading97" msdata:rowOrder="96" diffgr:hasChanges="modified">
<Club_Number>CN001</Club_Number>
<Bar_Number>BBS02</Bar_Number>
<Position>10</Position>
<Inventory_Item_ID>2188</Inventory_Item_ID>
<Product_Class>BEER</Product_Class>
<Product_Type>DOMESTIC</Product_Type>
<Product_Name>Lone Star Regular</Product_Name>
</MeterReading>
</ClubMeter>
<diffgr:before>
<MeterBar xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterBar1" msdata:rowOrder="0">
<Bar_Number>BBS01</Bar_Number>
<DISPLAY>BEER - BBS01</DISPLAY>
</MeterBar>
<MeterBar xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterBar2" msdata:rowOrder="1">
<Bar_Number>BBS02</Bar_Number>
<DISPLAY>BEER - BBS02</DISPLAY>
</MeterBar>
<MeterReading xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterReading16" msdata:rowOrder="15">
<Bar_Number>BBS01</Bar_Number>
<Position>11</Position>
<Inventory_Item_ID>12906</Inventory_Item_ID>
<Product_Class>SOFT-GOODS</Product_Class>
<Product_Type>SOFT DRINK</Product_Type>
<Product_Name>Full Throttle Coca Cola</Product_Name>
</MeterReading>
<MeterReading xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterReading96" msdata:rowOrder="95">
<Bar_Number>BBS01</Bar_Number>
<Position>10</Position>
<Inventory_Item_ID>2188</Inventory_Item_ID>
<Product_Class>BEER</Product_Class>
<Product_Type>DOMESTIC</Product_Type>
<Product_Name>Lone Star Regular</Product_Name>
</MeterReading>
<MeterReading xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterReading17" msdata:rowOrder="16">
<Bar_Number>BBS02</Bar_Number>
<Position>11</Position>
<Inventory_Item_ID>12906</Inventory_Item_ID>
<Product_Class>SOFT-GOODS</Product_Class>
<Product_Type>SOFT DRINK</Product_Type>
<Product_Name>Full Throttle Coca Cola</Product_Name>
</MeterReading>
<MeterReading xmlns="http://tempuri.org/ClubMeter.xsd" diffgr:id="MeterReading97" msdata:rowOrder="96">
<Bar_Number>BBS02</Bar_Number>
<Position>10</Position>
<Inventory_Item_ID>2188</Inventory_Item_ID>
<Product_Class>BEER</Product_Class>
<Product_Type>DOMESTIC</Product_Type>
<Product_Name>Lone Star Regular</Product_Name>
</MeterReading>
</diffgr:before>
</diffgr:diffgram>
</Readings>
</MeterTransaction>
From the above abbreviated XML document, how do I get the values from the nodes of MeterBar and MeterReading nodes?
I really appreciate your help in this regard.
Thanks,
Bidhan -
Key fields and non-key field of condition table
Hello Gurus,
what is key fields and non-key field of condition table?
thanks very much!Key field
Each condition table contains keys that can be used for creating dependent condition records.
for example let take condition type PR00.
PR00 uses access sequence PR02 .
Access sequence PR02 has following tables associated with it namely 304, 305 & 306
When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
Non key field
For example take condition table 144 - sales deal basic data.
Table 144 is associated with access sequence PBUD.
If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme. -
Getting all occurrences from a clob field
I created a clob field to store an XML document. I have tried the SUBSTR, INSTR, REGEXP_SUBSTR, DBMS_LOB.INSTR functions to extract all occurrence of the XML tab <systemLink>.
I just get 1 occurrence of the XML tag.
Has anyone done this before.
Thanks.All occurrences in a single row
select extract(xmltype(your_clob_field),'//systemLink')
from dualOr all occurrences in distinct rows
select *
from TABLE (XMLSEQUENCE (EXTRACT (XMLTYPE (your_clob_field), '//systemLink'))) ; Max
http://oracleitalia.wordpress.com -
Multiple clob fields in a single table
Are there any known performance issues associated with having 4 CLOB fields in a single table... the table as such will be relatively small.. like 100 MB... with most rows being << 50k.
Not really. If you need 4 CLOB columns and it makes sense to have alll the columns in a single table, go for it.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Export XML data from a CLOB field using sql developer
I have a table that contains a CLOB field, each record is a complete XML in itself. After running the select query i am exporting this data by right clicking on the answer set, while the export completes the data for each record gets truncated.
When i chose to save the export in loader format i get the complete records but now there are n files created for n records exported.
Is there a way i can get alll the records in a single file wirthout any truncation.
Thanks in advance!You might try delimited format or csv, with no enclosures if desired.
-
Urgent: How to set a default value to CLOB field?
Hi All,
As per the requirements we have to populate the CLOB field in a template with default value with some template similar to a letter issued to clients in bank.
So, every time when I insert a record in that table this CLOB field should have that letter template populated by default and user will modify that if required from GUI.
How can I populate that CLOB field by default?
Thanks!Something like this?
ME_XE?
create table test_clob
pk_value number primary key,
one_clob clob default rpad('something', 32000, '*')
insert into test_clob (pk_value) values (1);
select * from test_clob;
Table created.
Elapsed: 00:00:00.13
ME_XE?ME_XE?
1 row created.
Elapsed: 00:00:00.09
ME_XE?ME_XE?
PK_VALUE ONE_CLOB
1 something***********************************************************************
1 row selected.
Elapsed: 00:00:02.65
ME_XE?ME_XE?
ME_XE?ME_XE?select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
5 rows selected.
Elapsed: 00:00:00.18
ME_XE? -
Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field
Hello,
I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
Table structures are mentioned below:
OP:
Name Null Type
OP_NBR NOT NULL NUMBER(4) (Primary Key)
OP_DESC VARCHAR2(50)
OP_PAYLOD_XML CLOB
GM:
Name Null Type
GM_NBR NOT NULL NUMBER(4) (Primary Key)
GM_DESC VARCHAR2(40)
OP_NBR NOT NULL NUMBER(4) (Foreign Key)
GM_PAYLOD_XML CLOB
DM:
Name Null Type
DM_NBR NOT NULL NUMBER(4) (Primary Key)
DM_DESC VARCHAR2(40)
GM_NBR NOT NULL NUMBER(4) (Foreign Key)
DM_PAYLOD_XML CLOB
DE:
Name Null Type
DE_NBR NOT NULL NUMBER(4) (Primary Key)
DE_DESC NOT NULL VARCHAR2(40)
DM_NBR NOT NULL NUMBER(4) (Foreign Key)
DE_PAYLOD_XML CLOB
+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT
j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
FROM
DE g, DM h, GM i, OP j
WHERE
h.dm_nbr = g.dm_nbr(+) and
i.gm_nbr = h.gm_nbr(+) and
j.op_nbr = i.op_nbr(+)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
Current O/P:
<resultSet>
<Record1>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<DM_PAYLOD_XML1>
<DE_PAYLOD_XML1>
</Record1>
<Record2>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML2>
<DM_PAYLOD_XML2>
<DE_PAYLOD_XML2>
</Record2>
<RecordN>
<OP_PAYLOD_XMLN>
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XMLN>
</RecordN>
</resultSet>
Now i want to change my SQL query so that i get following output structure:
<resultSet>
<Record>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<GM_PAYLOD_XML2> .......
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XML1>
<DM_PAYLOD_XML2> .......
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XML1>
<DE_PAYLOD_XML2> .......
<DE_PAYLOD_XMLN>
</Record>
<Record>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML1'>
<GM_PAYLOD_XML2'> .......
<GM_PAYLOD_XMLN'>
<DM_PAYLOD_XML1'>
<DM_PAYLOD_XML2'> .......
<DM_PAYLOD_XMLN'>
<DE_PAYLOD_XML1'>
<DE_PAYLOD_XML2'> .......
<DE_PAYLOD_XMLN'>
</Record>
<resultSet>
Appreciate your help in this regard!Hi,
A few questions :
How's your first query supposed to give you an XML output like you show ?
Is there something you're not telling us?
What's the content of, for example, <OP_PAYLOD_XML1> ?
I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
What's the db version BTW? -
Make a clob field as an editable column in a report
Hello,
I have a CLOB field column in my report and want to make this as an editable item. Can anyone please tell me what would be the best approach to deal with these kind of issue.
Thanks,
OrtonDan McGhan wrote:
There is no "out of the box" solution for this. You'd have to do a bit of work. However, before we go down that road, I'm curious as to why you'd want to put a password field in a tabular form.
It's a multi row insert/update/delete (tabular) form, and one of the columns represents a password.
One row represents "an application". The column represents the application password.
I actually have two of them (columns) + a process that verifies that the same value was entered in both.
I'm suprised that this is not out-of-the box possible...
It would be a very easy to just support the 'password field' type in the dropdown list that I have now used to make it a simple text field. No?
Appreciate any assistance...
Edited by: Toon Koppelaars on Jul 14, 2010 1:20 PM -
Is it possible to add text field in condition type in PO?
Dear Guru,
Please kindly advice. Is it possible to add text field in condition type?
I mean I have seen condition type "FRB1" Freight value in the condition detail we can input vendor code.
So I would like to know is it possible to add text field in condition detail and how to set it up.
Thank you very much.We would like to maintain some text in condition because of we would like to get that text to PO print out and we don't want to do enhancement.
Ex: Condition Type: ZZZZ Insurance
PO Print out show
Item No. Desc Qty Unit Price Amount
10 Item description 10000 10 100000
20 Item description 10000 10 100000
30 Item description 10000 10 100000
Insurance <<Description about insurance>> 9,999
Edited by: Saiyaman on Oct 1, 2009 1:35 PM
Edited by: Saiyaman on Oct 1, 2009 1:36 PM -
How to store the contents of a text file directly in to a clob field
Hi All,
Could anyone help me to store the contents of a text file (*.txt,*.xml etc)directly in to a clob field.
Thanks in advance
Jayaram.One way is to use sqlloader. Three files are used. A control file, an xml data file, and a file with the path of the xml data file. Here's the control file. It reads load.file, which is the file with the path of the xml data file. It names the path ext_path, and inserts the xml into field xml_field.
CONTENTS OF CONTROL FILE:
load DATA
INFILE 'load.file'
APPEND
INTO TABLE xml_table
( ext_path FILLER CHAR(13),
"XML_FIELD" LOBFILE(ext_fname) TERMINATED BY EOF
CONTENTS OF FILE LOAD.FILE:
/tmp/load.dat
The xml is in the file /tmp/load.dat.
null -
Inserting to a CLOB field in Oracle 8i Database
Hi All,
I am trying to insert a value to a CLOB field in Oracle 8i DB.
The value gets inserted when the size is less (Up to around 80 Bytes).
When the size becomes larger the insertion does not take place but no exception is thrown.
Please see below the code I have written.
PreparedStatement preparedStatement = null;
try {
connection = getConnection(MMAKeys.WMDS_DATASOURCE);
String query = "UPDATE s_mmhp_batch SET MMHP_REPORT_CLOB=(?) WHERE MMHP_BATCH_ID=(?) AND MMHP_USER_ID=(?) AND MMHP_MEMBER_KEY=(?)";
preparedStatement=connection.prepareStatement(query);
Reader r = new StringReader(clobReport);
preparedStatement.setCharacterStream(1, r, clobReport.length());
oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(connection , false, oracle.sql.CLOB.DURATION_CALL);
newClob.putString(1,clobReport);
preparedStatement.setClob(1,newClob);
preparedStatement.setInt(2,batchId);
preparedStatement.setString(3,userId);
preparedStatement.setString(4,memberKey);
preparedStatement.executeUpdate();
System.out.println("inside the write to Batch method after executing the query");
} catch (SQLException exception) {
throw new DAOException(
"MREDMMSDAO -> writeToTable():SQLException"
+ exception.getMessage());
} catch (Exception exception) {
throw new DAOException(
"MREDMMSDAO -> writeToTable():Exception"
+ exception.getMessage());
} finally {
closeStatement(preparedStatement);
closeConnection(connection);
I came to know that this method is not supported in Oracle 8i.
I tried to create an empty CLOB and call the putValue() method.
But Then, I got an exception stating that the method is not supported.
Is there any other way to insert a CLOB value to Oracle 8i?
Please help.
Thanks in advance,
NeelambaryAnd cursor.callproc('insert_clob_proc', (clob,))
doesn't work for you?
PrzemekYes - I should have been more clear in my original post. The callproc function works until we have a value which is over 32K. At values over 32K, we get an error message "ORA-01460: unimplemented or unreasonable conversion requested". I believe this is because we are sending the value as a string and so we would need to figure out how to send as a CLOB in cx_Oracle? Here is some code to use to test if interested...
Oracle (Oracle Database 10g Release 10.1.0.4.0 - Production):
CREATE TABLE clob_test (CLOB_FIELD CLOB);
CREATE OR REPLACE PROCEDURE ins_clob_test (v_clob_field IN CLOB)
AS
BEGIN
INSERT INTO clob_test (clob_field) VALUES (v_clob_field);
END ins_clob_test;
Python (2.5):
conn = cx_Oracle.connect(xhash['oraclelogin'])
cursor = conn.cursor()
clob_var = 'Some test data' * 10000
cursor.callproc('ins_clob_test',(clob_var,))
conn.commit()
cursor.close()
conn.close()
I should also mention that I am the Oracle developer and not the Python programmer - my knowledge of Python is very limited. I would like the Python programmers to use the procedures (packages) I have created to do their inserts but this situation has caused them to put the SQL directly in their code.
Thanks again for any assistance you can provide.
Jason -
Inserting data into a CLOB Field
I am trying to insert a 100,000+ byte string into a CLOB field in Oracle, but I'm getting a "string literal too long" error. I am using Visual Basic and ADO to try to accomplish this. My insert statement is:
sql = "INSERT INTO IMAGE_VERSION " & _
"(field1, field2, field3)" & _
"VALUES('" & strNm & "', '" & strDt & "', '" & strData & "')"
Field 3 is defined as a CLOB in the database. From what I understand, the CLOB can hold massive amounts of data.
Can anyone lend a hand?Re: OTN Downloads
-
Hello,
I'm trying to export a CLOB field to a txt file. It's a xml string in the CLOB. I have used different methods but the only which i can use is PUT, PUT_LINE.
But:
- PUT does only export the 32565 characters. I see that the output of l_pos is 4202084 but these are not exported. I have tried FFLUSH, but this gives a error or my syntax is not correct.
- PUT_LINE is exporting the complete CLOB, but after every 32656 is new line is added and if I want to look with altove then I have to remove 129 times the new line. Thats not the way I want to go.
Is it an idea, if it is possible, that I write 32565 chars to the buffer (file), read these 32565 from the buffer minus one (=without \r\n), delete the last 32565 chars from buffer and append/put the chars 32565 minus the \r\n to the buffer again. I hope there will be a better idea but....
Has anybody an idea how I can solve this? Or what do I wrong?
Any help would be appreciated.
Beneath my code.
Nico
CREATE OR REPLACE DIRECTORY documents AS 'D:\TEST';
SET SERVEROUTPUT ON
DECLARE
l_file UTL_FILE.FILE_TYPE;
l_clob CLOB;
l_buffer VARCHAR2(32767);
l_amount BINARY_INTEGER := 32565;
l_pos INTEGER := 1;
l_lengte number;
l_lineCount number := 0;
BEGIN
SELECT PAYLOAD
INTO l_clob
FROM icepayloadext ext
WHERE EXT.PAYLOADTYPE in ('POST')
AND substr(payload, 0, 2000) like '%181015%'
AND ext.LSTIME between to_date('10-10-2012 00:00:00', 'dd-mm-rrrr HH24:mi:ss') and to_date('10-10-2012 17:30:00', 'dd-mm-rrrr HH24:mi:ss');
l_lengte := DBMS_LOB.GETLENGTH (l_clob);
DBMS_OUTPUT.PUT_LINE('lengte clob veld: ' || l_lengte);
l_file := UTL_FILE.fopen('DOCUMENTS', 'Sample1.txt', 'w', 32767);
LOOP
DBMS_LOB.read (l_clob, l_amount, l_pos, l_buffer);
UTL_FILE.PUT(l_file, l_buffer);
UTL_FILE.FFLUSH (l_file);
--UTL_FILE.PUT_LINE(l_file,'alles geschreven');
l_pos := l_pos + l_amount;
DBMS_OUTPUT.PUT_LINE('Offset position: ' || l_pos);
if (l_pos > l_lengte) then
exit;
end if;
END LOOP;
UTL_FILE.fclose(l_file);
--EXCEPTION
--WHEN OTHERS THEN
-- DBMS_OUTPUT.put_line(SQLERRM);
--UTL_FILE.fclose(l_file);
END;
/You can always try it the binary way:
DECLARE
l_file UTL_FILE.FILE_TYPE;
l_clob CLOB;
l_buffer VARCHAR2(32767);
l_amount BINARY_INTEGER := 32565;
l_pos INTEGER := 1;
l_lengte number;
l_lineCount number := 0;
BEGIN
l_clob := rpad( to_clob( 'test' ), 60000, 'test' );
l_lengte := DBMS_LOB.GETLENGTH (l_clob);
DBMS_OUTPUT.PUT_LINE('lengte clob veld: ' || l_lengte);
l_file := UTL_FILE.fopen( 'MY_DIR', 'Sample1.txt', 'wb', 32767 );
LOOP
begin
DBMS_LOB.read (l_clob, l_amount, l_pos, l_buffer);
exception
when no_data_found then exit;
end;
-- UTL_FILE.PUT_RAW( l_file, utl_raw.cast_to_raw( l_buffer ) ); -- file in database character set
UTL_FILE.PUT_RAW( l_file, utl_i18n.string_to_raw( l_buffer, 'WE8MSWIN1252' ) );
l_pos := l_pos + l_amount;
DBMS_OUTPUT.PUT_LINE('Offset position: ' || l_pos);
END LOOP;
UTL_FILE.fclose(l_file);
END;Anton -
Using Oracle Text with CLOB field containing multiple languages
I'm using Oracle 10g (NLS_CHARACTERSET is set to. AL32UTF8) and have a table with a CLOB field which is storing text written in either English and/or Simplified Chinese.
The following index has been created on this field:
CREATE INDEX text_index
ON text_table(text_field)
INDEXTYPE IS CTXSYS.CONTEXT
PARAMETERS('FILTER CTXSYS.INSO_FILTER');
I'm having issues in returning text which matches the Chinese text using the CONTAINS operator. For some reason the following query is returning rows which do not contain any Chinese text:
SELECT *
FROM text_table
WHERE contains(text_field,'炫%') > 1;
A newsgroup user advised me to produce an explain plan using ctx_query.explain.
I created 2 explain plans, one which was searching the index for 'A%' and the other searching for the Simplified Chinese character '炫%'. The results for the first test were as expected whereby the values contained within the OBJECT_NAME field all began with the letter 'A'.
The second test however produced somewhat unexpected results. The OBJECT_NAME field this time contained various words, both English and Simplified Chinese. I could be wrong but it appeared to store every individual word in the CLOB field. Both tests produced different EQUIVALENCE rows, the first test was:
OPTIONS = Null
OBJECT_NAME = A%
Whereas the second test produced:
OPTIONS = (?)
OBJECT_NAME = %
Am I right in thinking the Simplified Chinese character is for some reason being converted to a '?' character?
Any help on this will be much appreciated.As you're not specifying a lexer to use, it will use the BASIC_LEXER, designed for space-separated European-type languages. This won't work effectively with Chinese.
If you know which documents are Chinese and which are English, you can write this into a LANGUAGE column and use the MULTI_LEXER - this will allow you to specify BASIC_LEXER for the English texts, and CHINESE_LEXER or CHINESE_VGRAM_LEXER for the Chinese texts.
If you don't know the language, you must use either WORLD_LEXER (10g) or AUTO_LEXER (11g). These lexers will automatically determine the language of the documents and index them appropriately. In general. MULTI_LEXER will be faster and more accurate than either of the automatic alternatives.
When querying for Chinese characters you need to be very careful with your NLS_LANG settings. You need to make sure that the character set defined in NLS_LANG is the same as the character set from which you've pasted (or typed) the chinese characters.
The "?" in output usually just means "I don't know how to translate this character into your output character set". Sometimes it may appear as a reversed question mark.
Maybe you are looking for
-
Out of stock material report based on sales orders
Hi, I have a requirement to create a report where I need to show the unfulfilled sales orders due to materials were out of stock for those sales orders. e.g. there were 3 orders placed yesterday. we partialy delivered order - 1 as one of the material
-
How and where can I combine several pdf files?
I have written a Guide Book for Music Teachers in Word, converted it into a pdf file and would now like to insert sheet music files written with Sibelius Notation Program which have also been converted into pdf files, since they are otherwise not com
-
Peace. My name is Free. Thanks in advance for any help u can offer. My iPod cannot be synced because the required file could not be found. How do I fix this problem?
-
How to find ECC tables/ reports based on which a DB View is created?
Hi All, We have customized data source created based on a View/ Table. How can i find the ECC tables/ reports based on which this View has been created and also the logic behind which the different fields extract data from ECC.. Please advice. Than
-
Grouping reqs by Need by Date using Requisition Import
Requisition import is not considering need by date for grouping requisitions. Is there a way to achieve this? Thanks HT