Length restriction for clob-elements?
Hi all,
I am working with the Oracle Thick-Client (Oracle9i Enterprise Edition Release 9.2.0.6.0). I am using JDBC together with the Oracle XML DB (UTF-8).
My table is validated against an xsd-schema. The element <content> (see below) causes problems if I try to fill in a long string (over 8000 characters). The client somehow cuts the string off at an arbitrary position without producing an error. But it cuts off some characters.
Any ideas what could be my problem?
XSD:
<xs:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="content" type="xs:string" xdb:SQLType="CLOB"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="url" type="xs:anyURI"/>
<xs:element name="netpage" xdb:SQLType="NETPAGE_T">
<xs:complexType>
<xs:sequence>
<xs:element ref="title" xdb:SQLName="TITLE"/>
<xs:element ref="url" xdb:SQLName="URL"/>
<xs:element ref="content" xdb:SQLName="CONTENT"/>
</xs:sequence>
<xs:attribute name="no-content" type="xs:string" use="required" xdb:SQLName="A_NO_CONTENT"/>
<xs:attribute name="pageID" type="xs:long" use="required" xdb:SQLName="A_PAGE_ID"/>
<xs:attribute name="projectID" type="xs:long" use="required" xdb:SQLName="A_PROJECT_ID"/>
<xs:attribute name="type" type="xs:string" use="required" xdb:SQLName="A_TYPE"/>
</xs:complexType>
</xs:element>
</xs:schema>
The java-code to insert the document is:
private void doInsertDocument(Document doc, String table) throws SQLException {
PreparedStatement stmt = null;
String documentString;
documentString = XMLUtility.formatedPrintDoc(doc, "UTF-8");
synchronized (key) {
try {
stmt = databaseConnection.prepareStatement("INSERT INTO " + table
+ " VALUES (?)");
XMLType xmltype = null;
xmltype = XMLType.createXML(databaseConnection, documentString);
stmt.setObject(1, xmltype, XMLType._SQL_TYPECODE);
stmt.execute();
} catch (SQLException e) {
throw e;
} finally {
try {
stmt.close();
} catch (RuntimeException re) {
re.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
Any help would be appreciated.
thanks
emil
I think you need to try something like this...
OracleCallableStatement statement = null;
String statementText;
CLOB clob = CLOB.createTemporary( getConnection(), true, CLOB.DURATION_SESSION);
statementText = "insert into " + this.getSetting(this.TABLE_NAME) + " values(xmltype(:1))";
System.out.println("GetXMLType.doSomething : Driver Type = " + this.getDriver() + ". Statement = " + statementText);
statement = (OracleCallableStatement) getConnection().prepareCall(statementText);
InputStream is = new FileInputStream(getSetting(this.SOURCE_FILE));
InputStreamReader reader = new InputStreamReader( is );
Writer writer = clob.setCharacterStream(0);
char [] buffer = new char [ clob.getChunkSize() ];
for( int charsRead = reader.read( buffer );
charsRead > - 1;
charsRead = reader.read( buffer ) )
writer.write( buffer, 0, charsRead );
writer.close();
reader.close();
statement.setCLOB(1,clob);
boolean result = statement.execute();
is.close();
CLOB.freeTemporary(clob);
statement.close();
getConnection().commit();
getConnection().close();
}
Similar Messages
-
Length restriction on literal value for constant defined declaratively
When defining a program data item which is a constant varchar2(120) - I am restricted to a default value of length 60 (about 50 short of requirements). Does any one know why this length restriction is applied. Is there an intention to remove this limitation?
1. In Forms 6i, there is a limit of 255 characters on the FORMS60_PATH. The
forms runtime crashes, if the length becomes 256 characters or more.
This is documented in Note 125007.1 Access Violation in Ora805.dll Caused By
Forms When Forms60_path Longer Than 255 Chars
2. In Forms 9i/10g, the limitation is 511 characters. If FORMS90_PATH contains
512 or more characters, it is ignored. ORACLE_HOME cannot be more than 39 characters long.
3. In Forms 10.1.2, the limit has been increased, that is, FORMS_PATH length has been doubled (1024).
The new limit for ORACLE_HOME is 68 characters.
A workaround
Set ORACLE_PATH
Regards -
Problem with the field length restrictions in the WSDL file
Hi all,
We have created a XSD file where we have defined fields and given some restrictions (like minLength, maxLength) for each field. See below one ex of one element "Id":
{code <xs:simpleType name="Id">
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>
{code}
Here we have defined maxLength of this field as 40 chars. Our WSDL uses (refers/import) this XSD file and we ganerates java skeleton using RAD. But at runtime if we set more than 40 chars then also it is accepting. It is not throwing an exception. (In the generated java skeletion these restrictions are not reflected antwhere)
I have one question that, if such restrictions defined in the XSD file works or not? and is it a industry standard to define restriction in the XSD file?
If yes then what i need to do more to make it working?
If not then is there any way to do such validation of the fields that are input to the webservice? Or shall i have to just write my own java class to validate each field?
Regards,
RaviOr is it possible that we give length restrictions in the XSD (and import this XSD in WSDL) and generate java skeleton from WSDL then the restrictions defined in XSD are mapped into java classes?
For ex:
<xs:simpleType name="Id">
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
</xs:simpleType>so when in generated java skeleton we set value to "Id" element which is more than 40 charsthen it should throw a exception?
Is it possible by default or do we need to write custom validation classes to do validations on such fields?
Has anybody worked in such scenerios?
Or how to do field validations in webservice? Simple question.
Thanks In Advance. -
Limitation for CLOB columns? - ORA-01704: string literal too long
Hello!
I'm trying to update a CLOB column with more than 35000 characteres, but I get "ORA-01704: string literal too long".
The code:
declare
l_clob clob;
begin
update test set test = empty_clob()
WHERE ID = 1
returning test into l_clob;
dbms_lob.write( l_clob, length('A...here 35000xA...A'), 1,'A...here 35000xA...A');
end;
Is there any limitation for CLOB columns?
Thanks for help.
Danieluser605489 wrote:
32768 characteres :)Actually it's 1 character less than 32K...
*32767*
SQL> declare
2 v_vc varchar2(32768);
3 begin
4 null;
5 end;
6 /
v_vc varchar2(32768);
ERROR at line 2:
ORA-06550: line 2, column 17:
PLS-00215: String length constraints must be in range (1 .. 32767)
SQL>I guess it comes from a legacy thing where signed words (2 bytes) are/were used to represent a value. As the most significant bit of the word is used to represent the sign of the number the range goes from -32768 to 32767. -
Default insertion for missing elements using DBMS_XMLSave.insertXML
Hi,
I am trying to insert default values for some columns, without having those column names as elements in the xml document. Is it possible to do so?? This is the code I am using for now, but it inserts null values for missing elements in the xml document.
insCtx := DBMS_XMLSave.newContext ('TABLENAME'); -- get the context
rows := DBMS_XMLSave.insertXML (insCtx, p_xmlDoc); -- insert the doc
DBMS_XMLSave.closeContext (insCtx); -- close the handleOnly thing I noticed with dbms_xmlstore.insertXML, was when my xml document had "<?xml version = "1.0" ?>" at the start, it gave an error "LPX-00209: PI names starting with XML are reserved"That's probably due to the XML document not starting exactly with "<", like this :
SQL> DECLARE
2
3 xmldoc clob := '
4 <?xml version="1.0"?>
5 <ROWSET>
6 <ROW>
7 <COL1>1</COL1>
8 <COL2>TEST1</COL2>
9 </ROW>
10 <ROW>
11 <COL1>2</COL1>
12 </ROW>
13 </ROWSET>';
14
15 ctx dbms_xmlstore.ctxHandle;
16 numrows number;
17
18 BEGIN
19
20 ctx := dbms_xmlstore.newContext('MY_TABLE');
21 numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
22 dbms_xmlstore.closeContext(ctx);
23
24 END;
25 /
DECLARE
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00209: PI names starting with XML are reserved
ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
ORA-06512: at line 21 However, it runs OK if the prolog actually starts the character stream :
SQL> DECLARE
2
3 xmldoc clob := '<?xml version="1.0"?>
4 <ROWSET>
5 <ROW>
6 <COL1>1</COL1>
7 <COL2>TEST1</COL2>
8 </ROW>
9 <ROW>
10 <COL1>2</COL1>
11 </ROW>
12 </ROWSET>';
13
14 ctx dbms_xmlstore.ctxHandle;
15 numrows number;
16
17 BEGIN
18
19 ctx := dbms_xmlstore.newContext('MY_TABLE');
20 numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
21 dbms_xmlstore.closeContext(ctx);
22
23 END;
24 /
PL/SQL procedure successfully completed.
With the dbms_xmlsave.inserXML, [...] it wont insert the default column values.Now that's strange...
I understand there could be differences in the parsing implementation, but in the end both processes must issue an INSERT into the target table using plain SQL, so I really wonder why default values are not applied.
I'll try to reproduce when I have access to a Java-enabled db. -
Hi all,
As per the EDI defined standard schema, AT701 element takes the following Enumeration values.
<xs:element minOccurs="0" name="AT701" type="X12_ID_1650">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo notes="Shipment Status Code_1650" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:simpleType name="X12_ID_1650">
<xs:restriction base="xs:string">
<xs:enumeration value="A3" />
<xs:enumeration value="A7" />
<xs:enumeration value="A9" />
<xs:enumeration value="AF" />
<xs:enumeration value="AG" />
<xs:enumeration value="AH" />
<xs:enumeration value="AI" />
<xs:enumeration value="AJ" />
<xs:enumeration value="AM" />
<xs:enumeration value="AN" />
<xs:enumeration value="AP" />
<xs:enumeration value="AR" />
<xs:enumeration value="AV" />
<xs:enumeration value="B6" />
<xs:enumeration value="BA" />
<xs:enumeration value="BC" />
<xs:enumeration value="C1" />
<xs:enumeration value="CA" />
<xs:enumeration value="CD" />
<xs:enumeration value="CL" />
<xs:enumeration value="CP" />
<xs:enumeration value="D1" />
<xs:enumeration value="I1" />
<xs:enumeration value="J1" />
<xs:enumeration value="K1" />
<xs:enumeration value="L1" />
<xs:enumeration value="OA" />
<xs:enumeration value="OO" />
<xs:enumeration value="P1" />
<xs:enumeration value="PR" />
<xs:enumeration value="R1" />
<xs:enumeration value="RL" />
<xs:enumeration value="S1" />
<xs:enumeration value="SD" />
<xs:enumeration value="X1" />
<xs:enumeration value="X2" />
<xs:enumeration value="X3" />
<xs:enumeration value="X4" />
<xs:enumeration value="X5" />
<xs:enumeration value="X6" />
<xs:enumeration value="X8" />
<xs:enumeration value="XB" />
</xs:restriction>
</xs:simpleType>
Now, in my sample input file I am having a column "MileStone", and for example: If I have
"Picked Up Date" in that column, I need to pass "A3" as the value for
AT701 element as per the above code snippets.
Please let me know how to map the "Milestone to "AT701" element.
If I straight away map those two fields, I am getting the below error :
error btm1046: Output validation error: The 'AT701' element is invalid - The value 'MileStone_0' is invalid according to its datatype 'http://schemas.microsoft.com/BizTalk/EDI/X12/2006:X12_ID_1650' - The Enumeration constraint failed.
So, please guide me on how to map the above fields using the functoids.
Thanks in Advance..Hi Anand,
You can try
Value Mapping functiod along with Logical Equal functiod for this requirement.
Connect the element “MileStone”
to the Logical Equal functiod as the it’s first parameter. And add “Picked Up Date”
as the second parameter.
Connect output of the Logical Equal functiod as the first parameter to the Value Mapping functiod and “A3"
as the second parameter.
Connect the output of
Value Mapping functiod “AT701”
element.
This maps the value “A3”
to the element “AT701”, if the value of “MileStone” element is
“Picked Up Date”
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
Hello Oracle-Experts,
I had to calculate hash-values for a corrorponding CLOB-field (see my post 'Buffer to small ORA-22835 error after migration from 9i to 10g' in forum 'database general').
I calculate the hash-values with the DBMS_UTILITY.GET_HASH_VALUE, e.g:
SQL> SELECT DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30)) FROM dual;
DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30))
1053896858
Because the calculation failed with 10g I had taken a closer look at this function and realised the following results:
VALUE DBMS_UTILITY.GET_HASH_VALUE(VALUE,1,POWER(2,30))
LPAD('X',3997,'X') 557754150
LPAD('X',3998,'X') 1053896858
LPAD('X',3999,'X') 888036750
LPAD('X',4000,'X') 162062978
LPAD('X',4001,'X') 162062978
LPAD('X',4002,'X') 162062978
LPAD('X',10000,'X') 162062978
It seems to me that I can't use this function for clob-values with a length greater than 4000 characters because of collisions. Maybe someone with experience
can give me a hint to handle this problem. Worst case i had to write my own CLOB_2_HASH function.
TIA + Best regards
MatthiasYeah, the 4000-byte limit would be a factor in working CLOBs. I if you only had 4000 bytes you would not need a CLOB in the first place.
If you don't find something better then writing your own function might be the thing to do. -
Is there a script available for arranging elements for optimal use of the printable area?
I'm starting a sticker printing business using Illustrator as my main layout and illustration too. I was wondering if there's a script available for automatically arranging a set of elements on a page so that they optimally take up the available space. I figured this would save me some on material costs.
If I were to create a script from scratch, can someone give me pointers? I'm a casual AI user but I have Javascript experience.
Thanks.The below image shows the 4 different die sizes, the artwork fits inside the dotted box so make sure that we have room around the die and the drill holes are assigned as well.
The name of each die is listed above it, and the size is listed below it.
The script is set to take each die and place it on the template until it is full, then it will save it and move it to the folder where it will be grabbed and preped for printing.
Everything below the **** is the script.
#target illustrator
var tempDoc = app.activeDocument;
copy();
if (tempDoc.selection.length > 0)
var myFile = File("S:/TEMPLATES/IN USE/DB_TEMPLATE.ai");
app.open(myFile);
var thisDoc = app.activeDocument;
thisDoc.views[0].centerPoint = [324,503];
thisDoc.views[0].zoom = .65;
var allGroups;
var horizontalCords = [0,180,360,540,0,180,360,540,0,180,360,540,0,180,360,540,0,180,360,540,0];
var verticalCords = [1012.5,1012.5,1012.5,1012.5,810,810,810,810,607.5,607.5,607.5,607.5,405,405,405,405,202. 5,202.5,202.5,202.5,202.5];
var oneGroups = new Array();
var twoGroups = new Array();
var oneAGroups = new Array();
var twoAGroups = new Array();
var makeNew1 = new Array();
var makeNew2 = new Array();
var twoACounter = 0;
var layerRemainder = [4,4,4,4];
var totalDies = 0;
var noGo = 0;
var caseTest;
if (thisDoc.pageItems.length == 0)
drawTemplate();
var newLayer = thisDoc.layers.add();
newLayer.name = "Die Layer";
paste();
allGroups = thisDoc.groupItems;
for (i=0;i<allGroups.length;i++){// determine what dies are present
if (allGroups[i].name == "1"){
oneGroups.push(allGroups[i]);
else
if (allGroups[i].name == "1A"){
oneAGroups.push(allGroups[i]);
if (allGroups[i].name == "2") {
twoGroups.push(allGroups[i]);
else
if (allGroups[i].name == "2A"){
twoAGroups.push(allGroups[i]);
}// end FOR
if (oneAGroups.length == 1)
oneAGroups[0].position = [540,101.5];
if (twoAGroups.length == 1)
twoAGroups[0].position = [360.25,101.25];
if (oneAGroups.length == 1 && twoAGroups.length == 1)
oneAGroups[0].position = [360,203.5];
if(oneAGroups.length == 2){
var add1Group = thisDoc.groupItems.add();
add1Group.name = "1";
oneAGroups[0].name = "1A changed";
oneAGroups[1].name = "1A changed";
oneAGroups[0].position = [0,0];
oneAGroups[1].position = [0,-100.75];
oneAGroups[0].moveToBeginning(add1Group);
oneAGroups[1].moveToBeginning(add1Group);
oneGroups.push(add1Group);
oneAGroups.length = 0;
redraw();
if(twoAGroups.length == 2){
var add2Group = thisDoc.groupItems.add();
add2Group.name = "2";
twoAGroups[0].name = "2A changed";
twoAGroups[1].name = "2A changed";
twoAGroups[0].position = [0,0];
twoAGroups[1].position = [0,-100.75];
twoAGroups[0].moveToBeginning(add2Group);
twoAGroups[1].moveToBeginning(add2Group);
twoGroups.push(add2Group);
twoAGroups.length = 0;
redraw();
if (twoGroups.length > 0){
var h = 0;
var v = 0;
var dieCount = 0;
for (i = 0; i < twoGroups.length; i++) {
twoGroups[i].position = [horizontalCords[h],verticalCords[v]];
h = h + 2;
v = v + 2;
dieCount++
}//end FOR
}// end twoGroups length IF
if (oneGroups.length > 0){
var h = 0+(twoGroups.length*2);
var v = 0 + (twoGroups.length*2);
for (i = 0; i < oneGroups.length; i++){
oneGroups[i].position = [horizontalCords[h],verticalCords[v]];
h = h +1;
v = v + 1;
}// end FOR
}// end onGroups IF
redraw();// redraws template so it updates changes on the page
//thisDoc.close(SaveOptions.SAVECHANGES);
}// end noGo
else
alert("You have nothing selected...");
totalDies = (oneGroups.length + (twoGroups.length*2) + (twoAGroups.length/2) + (oneAGroups.length/2));
if (totalDies < 20)
caseTest = 0
else if (totalDies > 20)
caseTest = 1
else if (totalDies == 20)
caseTest = 2;
switch (caseTest)
case 0:
thisDoc.close(SaveOptions.SAVECHANGES);
break;
case 1:
alert ("Die will not fit on the Template at this time. Try again later.");
thisDoc.close(SaveOptions.DONOTSAVECHANGES);
break;
case 2:
var answer = confirm ("The Template is full. Do you want to clear it?");
if (answer == true)
printTheTemplate();
break;
function drawTemplate(){ //draws the template if the page is empty
var tempDoc = app.activeDocument;
tempDoc.rulerOrigin = [0,0];
tempDoc.pageOrigin = [0,0];
var newLayer = tempDoc.layers.add();
newLayer.name = "Template Layer";
var templateGroup = tempDoc.groupItems.add();
templateGroup.name = "Template Build";
var vertLoc = .25;
var horzLoc = -.25;
var topTemp = new Array();
var botTemp = new Array();
var leftTemp = new Array();
var rightTemp = new Array();
for (i=0;i<5;i++){
botTemp[i] = thisDoc.pathItems.rectangle(0,vertLoc,.5,21);
topTemp[i] = thisDoc.pathItems.rectangle(1033,vertLoc,.5,21);
botTemp[i].moveToBeginning(templateGroup);
topTemp[i].moveToBeginning(templateGroup);
vertLoc = vertLoc + 180;
for (j=0; j<6;j++){
leftTemp[j] = thisDoc.pathItems.rectangle(horzLoc,-21,21,.5);
rightTemp[j] = thisDoc.pathItems.rectangle(horzLoc,720,21,.5);
leftTemp[j].moveToBeginning(templateGroup);
rightTemp[j].moveToBeginning(templateGroup);
horzLoc = horzLoc +202.5;
return
}// end function drawTemplate
function printTheTemplate()
// October 16, 2012 Henry J. Klementovich
//var TemplatePath = File("C:/Users/henryk/Desktop/Illustrator Test Files/HS_TEMPLATE.ai");
//open(TemplatePath)
//open(myFile);
var thisDoc = app.activeDocument;
thisDoc.rulerOrigin = [0,0];
thisDoc.pageOrigin = [0,0];
var thePath = ("S:/TEMPLATES/PRINTED");
// Will only continue if the artist has selected the art. This step saved a lengthy FOR loop that would have had to select each page or path item of the
// document. Some of the templates had over 5,000 items, resulting in an un-exceptable wait-time for the loop to select them.
for (x=0;x<thisDoc.groupItems.length;x++)
thisDoc.groupItems[x].selected = true;
if (thisDoc.selection.length > 0)
// This section pulls the date from the system for two purposes: the date shown on the template and the date used to save the file to the ArtShare.
// They are different b/c system filenames cannot include the ":" char, which is used on the template for the time object.
var theDate = new Date();
var day = theDate.getDate();
var month = theDate.getMonth() + 1;
var year = theDate.getFullYear();
var hours = theDate.getHours();
var min = theDate.getMinutes();
if (min < 10)
min = ("0" + min);
var morn;
if (hours >= 12)
hours = hours - 12;
morn = " PM";
else
morn = " AM"
var saveDate = (month + "-" + day + "-" + year + " " + hours + min + morn );
var tempDate = thisDoc.textFrames.add();
tempDate.name = theDate;
tempDate.contents = (month+ "/" + day + "/ " + year + " " + hours + ":" + min );
tempDate.top = 1026;
tempDate.left =40;
tempDate.filled = true;
var actGroups = thisDoc.selection;
var artGroup = thisDoc.groupItems.add();
artGroup.name = "Art Group";
for (i=0;i<actGroups.length;i++)
actGroups[i].moveToEnd(artGroup);
tempDate.moveToEnd(artGroup);
artGroup.selected = true;
copy();
thisDoc.pageItems.removeAll();// copies everything from the current template into the clipboard, clears the template, saves it and closes it.
var layLen = app.activeDocument.layers.length;
//alert(layLen);
for (i=0;i<layLen;i++)
app.activeDocument.layers[0].remove();
thisDoc.close(SaveOptions.SAVECHANGES);
app.documents.add();// adds new document for the template to be saved in the Printed folder.
paste();
var thisDoc = app.activeDocument;
var saveName = new File (thePath + "/" + saveDate);
saveOpts = new IllustratorSaveOptions();
saveOpts.compatibility = Compatibility.ILLUSTRATOR13;
saveOpts.generateThumbnails = true;
saveOpts.preserveEditability = true;
thisDoc.saveAs( saveName, saveOpts );
var actGroups = thisDoc.selection;
copy();
thisDoc.close(SaveOptions.SAVECHANGES);
$.sleep(10);
app.documents.add();
paste();
var nexDoc = app.activeDocument;
var actGroups = nexDoc.selection;
var artGroup =nexDoc.groupItems.add();
artGroup.name = "Art Group";
for (i=0;i<actGroups.length;i++)
actGroups[i].moveToEnd(artGroup);
//artGroup.selected = true;
artGroup.resize(70,70);
alert("The current template has been saved to the Printed Templates folder. This page is to be printed and sent to editing.")
Hope this helps someone get one created because if they can make one that doesn't depend on the premade dies that would help me out quite a bit because some of the dies that we make are an odd size so we have to place them manually. -
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion
Hi all,
the following query select to_char(nvl(round(pc.target_cost*xx_primavera.geteurtolvrate,2),amount),'FM999G999G999G999G990D00') detail_amount,
nvl(ct.cost_type, description) detail_description,
tm_desc.memo_id,
primavera_prj_name detail_prj_name,
hp.party_number detail_party_number,
xpid.interface_line_attribute1,
utl_i18n.unescape_reference(replace(regexp_replace(utl_raw.cast_to_varchar2(tm_desc.task_memo), '<[^>]*>'), chr(13)||chr(10))) document_description,
REPLACE(regexp_replace(utl_raw.cast_to_varchar2(tm_id.task_memo), '<[^>]*>'), chr(13)||chr(10)) prim_memo_client_id
from XX_PRIMAVERA_INVOICES_DETAIL xpid
join admuser.xx_ar_hz_parties xahp on xahp.orig_system_bill_customer_id = xpid.orig_system_bill_customer_id
join hz_parties hp on hp.party_id = xahp.party_id
left join admuser.projcost pc on pc.proj_id = xpid.primavera_prj_id and pc.cost_type_id != 29 and xpid.service_code = 8 and pc.task_id = xx_primavera.getTaskId(xpid.primavera_prj_id,'A1020', 'Изготвяне на оферта') and delete_session_id is null
left join admuser.costtype ct on ct.cost_type_id = pc.cost_type_id
left join admuser.taskmemo tm_id on tm_id.proj_id = xpid.primavera_prj_id and tm_id.memo_type_id = 53 and tm_id.task_id = xx_primavera.getTaskId(xpid.primavera_prj_id,'A1020', 'Изготвяне на оферта')
left join admuser.taskmemo tm_desc on tm_desc.proj_id = xpid.primavera_prj_id and tm_desc.memo_type_id = 55 and tm_desc.task_id = xx_primavera.getTaskId(xpid.primavera_prj_id,'A1020', 'Изготвяне на оферта')
where amount != 0
and xpid.interface_line_attribute1 = :ra_ctp_attribute1
ORDER BY xpid.primavera_prj_name, xpid.description;returns error:
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 2371, maximum: 2000) I found that the error occurs in the row : utl_i18n.unescape_reference(replace(regexp_replace(utl_raw.cast_to_varchar2(tm_desc.task_memo), '<[^>]*>'), chr(13)||chr(10))) document_description,and tried to change it to: utl_i18n.unescape_reference(replace(regexp_replace(utl_raw.cast_to_varchar2(dbms_lob.substr(tm_desc.task_memo,1,2000)), '<[^>]*>'), chr(13)||chr(10))) document_description,....but it returns not value for that field... am i using dbms_lob.substr at the wrong place? The column 'tm_desc.task_memo' is BLOB type.
Any ideas how to cheat it ?
Version: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE 11.1.0.7.0 Production"
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionThanks in advance,
Bahchevanov.Your second example has the parameters reversed. The amount (length) comes first and then the offset:
DBMS_LOB.SUBSTR (
lob_loc IN BLOB,
amount IN INTEGER := 32767,
offset IN INTEGER := 1)
RETURN RAW;
DBMS_LOB.SUBSTR (
lob_loc IN CLOB CHARACTER SET ANY_CS,
amount IN INTEGER := 32767,
offset IN INTEGER := 1)
RETURN VARCHAR2 CHARACTER SET lob_loc%CHARSET;
DBMS_LOB.SUBSTR (
file_loc IN BFILE,
amount IN INTEGER := 32767,
offset IN INTEGER := 1)
RETURN RAW;Also, remember that # of bytes is not necessarily the same as the # of characters depending on your character set. So 2000 bytes might become 4000 characters. And you have to make sure the BLOB is actually character data and not arbitrary binary data.
Post the results of reversing the parameters and using a smaller chunk size. -
Disable Technical Information for UI Element in WEB DYNPRO ABAP
Hi expert,
I want to disable Technical Information for UI Element in my web-dynpro application i am alredy disable in user setting by parameters WDDISABLEUSERPERSONALIZATION by i want to disbale other two options 1 Display quick help.
2 More field help.
KINDLY GIVE ME SUTIABLE SOULATION.
REGARD'S
VikashHi Vikash,
Check this thread, may be you'll get some clues from here.
[How to restrict right click to show user setting in WebDynpro ALV?;.
Regards
Manas Dua -
Hello,
for some reason, the test case below fails when driven with Java 6. Looks like, when long string data is stored in a XML element, DocumentHandler's characters() method will be provided with incorrect data.
With XML 1.0, parsing works fine in all my tests, Apache Xerces, JRE 5, JRE 6.
With XML 1.1., parsing works fine with Apache Xerces, JRE5 but not with JRE6.
I've checked it with latest JRE 6 update 4.
Anyone else xperiencing such problems with XML1.1 parsing when using JAXP bundled with Java 6?
I've tried to file a bug at bugdatabase, but for some reason I got no response for my issue - so I'm trying the forum now ;-)
Thanx for comments
Merten
import java.io.StringReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import junit.framework.TestCase;
import junit.framework.TestResult;
import junit.framework.TestSuite;
/** snippet to demonstrate problem in SAXParser */
public class ProblemWithSAXParser extends TestCase
public static void main(String[] args)
TestResult result=junit.textui.TestRunner.run(suite());
System.exit(result.wasSuccessful() ? 0 : 1);
private static junit.framework.Test suite()
final TestSuite ts=new TestSuite();
ts.addTestSuite(ProblemWithSAXParser.class);
return (ts);
/** small DocumentHandler, just waiting for one and only XML element <c></c> */
class MySAXDocumentHandler extends DefaultHandler
boolean listening=false;
public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
throws SAXException
System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
if("c".equals(qName))
listening=true;
public void endElement(final String uri, final String localName, final String qName) throws SAXException
System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
if("c".equals(qName))
listening=false;
public void characters(final char ch[], final int start, final int length) throws SAXException
if(listening)
final String str=new String(ch, start, length);
System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
+ str);
sb.append(str);
private final StringBuffer sb=new StringBuffer();
/** return what I got for XML element <c></c> */
public String toString()
return (sb.toString());
/** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
* content in the XML element */
public void testWithSunAndApache() throws Exception
// test XML element content for <c> element
final StringBuffer plain_str=new StringBuffer("");
for(int i=0; i < 500; i++)
plain_str.append("0123456789 This is some text ").append(i).append(". ");
final String xml_orig=plain_str.toString();
// SAX parsers, one Sun, one (original) Apache Xerces
// accept that Apache Xerces is not in path ...
final String prop_name="javax.xml.parsers.SAXParserFactory";
final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
System.setProperty(prop_name, prop_val_sun);
final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
System.out.println("SaxParser Sun= " + sax_sun);
assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
System.setProperty(prop_name, prop_val_apache);
SAXParser sax_apache;
try
sax_apache=SAXParserFactory.newInstance().newSAXParser();
catch(final Throwable t)
System.err.println("no Apache Xerces in path? " + t);
sax_apache=null;
System.out.println("SaxParser Apache= " + sax_apache);
assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
// i==0: XML 1.0, i==1: XML 1.1
for(int i=0; i <= 1; i++)
assert i == 0 || i == 1;
final String xml_version=(i == 0 ? "1.0" : "1.1");
final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
sb.append(xml_orig);
sb.append("</c>");
final String xml=sb.toString();
// parse it!
final StringReader string_reader_sun, string_reader_apache;
string_reader_sun=new StringReader(xml);
final InputSource input_source_sun=new InputSource(string_reader_sun);
string_reader_apache=new StringReader(xml);
final InputSource input_source_apache=new InputSource(string_reader_apache);
final MySAXDocumentHandler my_handler_sun, my_handler_apache;
my_handler_sun=new MySAXDocumentHandler();
my_handler_apache=new MySAXDocumentHandler();
sax_sun.parse(input_source_sun, my_handler_sun);
if(sax_apache!=null)
sax_apache.parse(input_source_apache, my_handler_apache);
final String xml_sun=my_handler_sun.toString();
final String xml_apache=my_handler_apache.toString();
assertNotNull(xml_sun);
assertNotNull(xml_apache);
System.out.println("xml version " + xml_version);
System.out.println("xml " + xml);
System.out.println("xml_orig " + xml_orig);
System.out.println("xml_sun " + xml_sun);
System.out.println("xml_apache " + xml_apache);
// test the data returned from DocumentHandler
if(sax_apache!=null)
assertEquals(xml_orig, xml_apache);
assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
}thanx, DrClap, haven't seen the "code" button for some reason, code is attached again
The output of my test is like this for JRE6 (truncated)
xml_sun 456789 This is is some text 0. 0123456789 This is some text 1.
xml_apache 0123456789 This is some text 0. 0123456789 This is some text 1.
Notice, xml_sun not only starts wrong ("0123" missing) - for some reason, the text there is not "This is some text" but "This is is some text" - very interesting in a way. I guess there's an issue with repeated text chunks ...
So, the data in my XML element is kind of changed, the length of the string is okay but the characters are "misplaced" or so :-) I thought about a problem with StringBuffer first, but the StringBuffer works fine for Apache ... so I really think there's an issue with JRE 6's parser for XML 1.1
Merten
import java.io.StringReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import junit.framework.TestCase;
import junit.framework.TestResult;
import junit.framework.TestSuite;
/** snippet to demonstrate problem in SAXParser */
public class ProblemWithSAXParser extends TestCase
public static void main(String[] args)
TestResult result=junit.textui.TestRunner.run(suite());
System.exit(result.wasSuccessful() ? 0 : 1);
private static junit.framework.Test suite()
final TestSuite ts=new TestSuite();
ts.addTestSuite(ProblemWithSAXParser.class);
return (ts);
/** small DocumentHandler, just waiting for one and only XML element <c></c> */
class MySAXDocumentHandler extends DefaultHandler
boolean listening=false;
public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
throws SAXException
System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
if("c".equals(qName))
listening=true;
public void endElement(final String uri, final String localName, final String qName) throws SAXException
System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
if("c".equals(qName))
listening=false;
public void characters(final char ch[], final int start, final int length) throws SAXException
if(listening)
final String str=new String(ch, start, length);
System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
+ str);
sb.append(str);
private final StringBuffer sb=new StringBuffer();
/** return what I got for XML element <c></c> */
public String toString()
return (sb.toString());
/** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
* content in the XML element */
public void testWithSunAndApache() throws Exception
// test XML element content for <c> element
final StringBuffer plain_str=new StringBuffer("");
for(int i=0; i < 500; i++)
plain_str.append("0123456789 This is some text ").append(i).append(". ");
final String xml_orig=plain_str.toString();
// SAX parsers, one Sun, one (original) Apache Xerces
// accept that Apache Xerces is not in path ...
final String prop_name="javax.xml.parsers.SAXParserFactory";
final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
System.setProperty(prop_name, prop_val_sun);
final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
System.out.println("SaxParser Sun= " + sax_sun);
assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
System.setProperty(prop_name, prop_val_apache);
SAXParser sax_apache;
try
sax_apache=SAXParserFactory.newInstance().newSAXParser();
catch(final Throwable t)
System.err.println("no Apache Xerces in path? " + t);
sax_apache=null;
System.out.println("SaxParser Apache= " + sax_apache);
assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
// i==0: XML 1.0, i==1: XML 1.1
for(int i=0; i <= 1; i++)
assert i == 0 || i == 1;
final String xml_version=(i == 0 ? "1.0" : "1.1");
final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
sb.append(xml_orig);
sb.append("</c>");
final String xml=sb.toString();
// parse it!
final StringReader string_reader_sun, string_reader_apache;
string_reader_sun=new StringReader(xml);
final InputSource input_source_sun=new InputSource(string_reader_sun);
string_reader_apache=new StringReader(xml);
final InputSource input_source_apache=new InputSource(string_reader_apache);
final MySAXDocumentHandler my_handler_sun, my_handler_apache;
my_handler_sun=new MySAXDocumentHandler();
my_handler_apache=new MySAXDocumentHandler();
sax_sun.parse(input_source_sun, my_handler_sun);
if(sax_apache!=null)
sax_apache.parse(input_source_apache, my_handler_apache);
final String xml_sun=my_handler_sun.toString();
final String xml_apache=my_handler_apache.toString();
assertNotNull(xml_sun);
assertNotNull(xml_apache);
System.out.println("xml version " + xml_version);
System.out.println("xml " + xml);
System.out.println("xml_orig " + xml_orig);
System.out.println("xml_sun " + xml_sun);
System.out.println("xml_apache " + xml_apache);
// test the data returned from DocumentHandler
if(sax_apache!=null)
assertEquals(xml_orig, xml_apache);
assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
} -
Is wpg_docload.download filename length restricted to 78 Characters ?
All,
I am using the wpg_docload.download procedure successfully download files. I have encountered a problem when the FILENAME values on the content-disposition attachment tag exceeds 78 characters. Is this a true and limitation of the procedure or have I done something wrong in the construction of my call to the procedure? I have read the threads concerning the upload procedure and noticed filename length restrictions. Do these apply here also ?
Thanks In Advance,
Tom
Edited by: raudabat on Apr 23, 2009 6:38 AMBen,
Thanks for your reply. My code is very generic in its call to the procedure setting the mime type 'application/pdf' or 'application/ms-excel' and setting the attachment filename parameter. I wouldn't think the results SaveAs filename would have any restrictions in size dealing with directories since it is not allowed to specify the destination directory. My filename is pulled from the database. When I had a filename greater than 78 the wpg_docload function does not do anything or does not raise an error. This really restricts how a user can name there files. I dynamically create PDF and store them into the database using the document title as the filename for the download. However, if I have this limitation, I have to restrict how my user title there documents (or figure how to compress into meaningful titles).
I have no problem with the download functionality, just the filename length aspect. Hopefully, this can be changed or I will have to live with this limitation. Any insight helpful.
My site is on a intra-network server.
Tom -
Hi All,
Can Anyone please tell how to compare clob type in select query with where condition ?
Ex: field: Desc_ short(Clob )
field ean_code(number,pk)
And i want to see those ean_code list matching to particullar clob pattern matching in the record in any where in the record.
Please help.
Thanks and regards,
DK.COMPARE function
This function compares two entire LOBs or parts of two LOBs. You can only compare LOBs of the same datatype (LOBs of BLOB type with other BLOBs, and CLOBs with CLOBs, and BFILEs with BFILEs). For BFILEs, the file must be already opened using a successful FILEOPEN operation for this operation to succeed.
COMPARE returns zero if the data exactly matches over the range specified by the offset and amount parameters. Otherwise, a non-zero INTEGER is returned.
For fixed-width n-byte CLOBs, if the input amount for COMPARE is specified to be greater than (4294967295/n), then COMPARE matches characters in a range of size (4294967295/n), or Max(length(clob1), length(clob2)), whichever is lesser.
Syntax
DBMS_LOB.COMPARE (
lob_1 IN BLOB,
lob_2 IN BLOB,
amount IN INTEGER := 4294967295,
offset_1 IN INTEGER := 1,
offset_2 IN INTEGER := 1)
RETURN INTEGER;
DBMS_LOB.COMPARE (
lob_1 IN CLOB CHARACTER SET ANY_CS,
lob_2 IN CLOB CHARACTER SET lob_1%CHARSET,
amount IN INTEGER := 4294967295,
offset_1 IN INTEGER := 1,
offset_2 IN INTEGER := 1)
RETURN INTEGER;
DBMS_LOB.COMPARE (
lob_1 IN BFILE,
lob_2 IN BFILE,
amount IN INTEGER,
offset_1 IN INTEGER := 1,
offset_2 IN INTEGER := 1)
RETURN INTEGER;
Pragmas
pragma restrict_references(COMPARE, WNDS, WNPS, RNDS, RNPS);
Parameters
Table 17-7 COMPARE Function Parameters
Parameter Description
lob_1 LOB locator of first target for comparison.
lob_2 LOB locator of second target for comparison.
amount Number of bytes (for BLOBs) or characters (for CLOBs) to compare.
offset_1 Offset in bytes or characters on the first LOB (origin: 1) for the comparison.
offset_2 Offset in bytes or characters on the first LOB (origin: 1) for the comparison.
Returns
INTEGER: Zero if the comparison succeeds, non-zero if not.
NULL, if
amount < 1
amount > LOBMAXSIZE
offset_1 or offset_2 < 1
offset_1 or offset_2 > LOBMAXSIZE
Exceptions
Table 17-8 COMPARE Function Exceptions for BFILE operations
Exception Description
UNOPENED_FILE
File was not opened using the input locator.
NOEXIST_DIRECTORY
Directory does not exist.
NOPRIV_DIRECTORY
You do not have privileges for the directory.
INVALID_DIRECTORY
Directory has been invalidated after the file was opened.
INVALID_OPERATION
File does not exist, or you do not have access privileges on the file.
http://www.java2s.com/Code/Oracle/System-Packages/Usedbmslobcomparetocompare.htm -
Hi,
is it possible to restrict the manuall cost allocation (KB15n) just for special cost elements?
we would like to let just post on special ones...
Any ideas?
I didn´t found a special authorization object for cost elements in this transaction...
regards
florianHi,
Create a set using TCode GS01 for the special cost elements. Then create a validation rule which restricts postings to KB15N only if the cost elements fall within this set. This will give users the flexibility to add or remove cost elements as and when required.
Rgds
Shivram. -
Need script for Marginal Elements consists two tags
Hi Everyone,
I need a script for the Marginal Elements having two Paragraph tags. Object Styles, Library items are all availale for this job. My requirement is cut the two paragraph tags and put it in library items and also using object styles as well. Is it possible? Can you help for this. For more clarification i have attached that file also.
Waiting for your reply....Hi Try This code.....
main();
function main(){
if (app.documents.length!=0){
if(app.libraries.length!=0){
myStyleDialog();
else {
alert ("Please open the Library.");
else {
alert ("Please open a document and try again.");
exit(0);
function myStyleDialog(){
var myLabelWidth = 120;
var myParaStyleNames = myGetParagraphStyleNames();
//var myObjStyleNames = myGetObjectStyleNames();
var myDialog = app.dialogs.add({name:"Choose Styles to Place Anchor"});
with(myDialog.dialogColumns.add()){
with(borderPanels.add()){
with(dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Choose Paragraph Style1:", minWidth:myLabelWidth});
with(dialogColumns.add()){
myParaStyleDropdown1 = dropdowns.add({stringList:myParaStyleNames, selectedIndex:0});
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Choose Paragraph Style2:", minWidth:myLabelWidth});
with(dialogColumns.add()){
myParaStyleDropdown2 = dropdowns.add({stringList:myParaStyleNames, selectedIndex:0});
//~ with(dialogRows.add()){
//~ with(dialogColumns.add()){
//~ staticTexts.add({staticLabel:"Object Styles:", minWidth:myLabelWidth});
//~ }
//~ with(dialogColumns.add()){
//~ myObjectStyleDropdown = dropdowns.add({stringList:myObjStyleNames, selectedIndex:0});
//~ }
//~ }
myReturn = myDialog.show();
if(myReturn == true){
myParagraphStyle1 = myParaStyleNames[myParaStyleDropdown1.selectedIndex];
myParagraphStyle2 = myParaStyleNames[myParaStyleDropdown2.selectedIndex];
// myObjectStyle = myObjStyleNames[myObjectStyleDropdown.selectedIndex];
myDialog.destroy();
else {
myDialog.destroy();
function myGetParagraphStyleNames(){
var myStyleNames = app.documents.item(0).paragraphStyles.everyItem().name;
return myStyleNames;
//~ function myGetObjectStyleNames(){
//~ var myObjStyleNames = app.documents.item(0).objectStyles.everyItem().name;
//~ return myObjStyleNames;
//~ }
var myDoc = app.activeDocument;
var myStory = myDoc.stories;
var myParas, myCount = 0;
var myLib = app.libraries[0];
var AnchorItemName = prompt("Enter the Library Item Name Exactly","","Anchor Item");
for(i=0; i<myStory.length; i++)
myParas = myStory[i].paragraphs;
if (myParas.length>3)
for(j=0; j<myParas.length-1; j++)
var firstPara = myParas[j];
var nextPara = myParas[j+1];
var firstParaStyle = firstPara.appliedParagraphStyle.name;
var nextParaStyle = nextPara.appliedParagraphStyle.name;
if ((nextParaStyle == myParagraphStyle2)&&(firstParaStyle == myParagraphStyle1))
myText = myLib.assets.item (AnchorItemName).placeAsset (firstPara.insertionPoints[0])[0];
firstPara.move(LocationOptions.after, myText.insertionPoints[0]);
nextPara.move(LocationOptions.after, myText.insertionPoints[-1]);
myText.fit(FitOptions.frameToContent);
myCount++;
}//End if
}//End of Para iteration
}//End of If paralength>2
}//End of story iteration
alert(myCount + " Ocurrences Found and Processed");
Green4ever
Maybe you are looking for
-
"Replace document color" cannot be deselected
I checked "Replace document color" once, and now when I deselect it, it does not stick. I have tried to uncheck it many times (with PDFs open and without any PDFs open) but Acrobat still defaults to replace document color each time I open a new PDF.
-
How to deal with makefile??
I have a problem of following type when i tried to run "make all" since i got the Makefile in redhat linux 5. The error is of following type: [root@localhost project]# make all javac -cp .:examples dk/i1/sctp/AssociationId.java javac -cp .:examples d
-
IPod touch 2nd generation backlight doesnt work
My ipod backlight is not working, even when turned to full on brightness, it still dark. I restored my ipod and it still didnt work
-
No Setup.exe in 64-bit Oracle Data Access Components (ODAC) Dowload
Why is there no Setup.exe in the 64-bit Oracle Data Access Components (ODAC) Download? Are the only instructions for installing in the dowloaded readme file?
-
[Solved] No sound on Armada 1750
Hello everybody. After installing Arch on my old Armada 1750 laptop, I noticed that the legacy isa sound card was not automatically recognized and I can't use alsaconf (according to Alsa wiki). I know for sure that it works with snd-es18xx module and