How to know what node is not valid with XMLTYPE - oracle

Here is the code to validate an xml file in PL_SQL using XMLTYPE
doc := dbms_xmldom.newdomdocument;
... xml file is build
v_xml:=DBMS_XMLDOM.GETXMLTYPE(doc);
v_schema:=v_xml.createSchemaBasedXML('xml.xsd');
BEGIN
v_schema.schemavalidate();
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('XML File is not valid');
END;
Is there way to know where the file is not valid, what node ?
Thank you
Note : the exception hidden that way is this one :
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00333: literal "" is not valid with respect to the pattern

dbms_utility.format_error_stack is providing more error details, including LSX error messages, which gives you the type of validation error, like
dbms_output.put_line( dbms_utility.format_error_stack);
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00220: "" is wrong length, should be 12
ORA-06512: at "SYS.XMLTYPE", line 354

Related

how the 'tmpdata' and 'Get_Parameter_List' works in OracleForm?

I am new in OracleForms and Plsql, i found this code in a proyect:
PROCEDURE grabar IS
...
Pl_id paramlist;
...
BEGIN
pl_id := Get_Parameter_List ('tmpdata');
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List('tmpdata');
i want to konw that if 'tmpdata' does not exist i will get an error?
whit the line:
pl_id := Get_Parameter_List ('tmpdata');
am i inserting the data of 'tmpdata' in 'PL_id'
it is the 'tmpdata' a default variable of Oracleforms or something?
it is not OracleForms but it is a tool based in it so is so similar
I proved to change to:
pl_id := Get_Parameter_List ('tmpdata_HELLO');
enter code hereand the program passed to of this
the console show me this:
may 25, 2018 4:46:30 PM org.apache.tomcat.util.http.Parameters processParameters
INFORMACIÓN: Character decoding failed. Parameter [value] with value [%null] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
Note: further occurrences of Parameter errors will be logged at DEBUG level.
In this example, "tmpdata" is the name of a parameter list that may or may not exist. The "ID_NULL" is checking for the existence of the parameter list by checking of the ID returned has a value or not. If it has a value (ie, ID_NULL returns FALSE), then the parameter list is destroyed so that the "Create_Parameter_List" command will not get an error.
"Get_Parameter_List" will not throw an error if there is no parameter list by the given name ("tmpdata", in this case); it just returns null.

pin_rel issue while loading rated events (Error: Update Stored Procedure: 8003)

I'm getting the following error while loading the .out file using pin_rel
Error 02/28/16 10:46:56:0552 PM ( 1456728416552 ) T:Update SP Thread 1 REL RELUpdaterThread 1:ece:UnknownProgramName:0:Update SP Thread 1:0:1456728416:0
RA-20003: Error -20015error while processing data from event_essentials occurred in the update procedure start_obj_id0 = 1449525761317588038 end_obj_id0 = 1449525761317588038 sqlcode = -20015 sqlerrm = ORA-20015: precommit failed (with exception): 18838741
ORA-06512: at "PIN10.PIN_REL", line 4260
ORA-29532: Java call terminated by uncaught Java exception: DeterminateError - ERR_BAD_OPCODE
FList.java:0: ErrBuf Fields:
Error=ERR_BAD_OPCODE Loc=DM
Field=PIN_FLD_OP_SQL_TRACE Rec=0 reserved=35
Facility=0 MessageID=0 Time=4:00 PM Version=0 Reserved2=0
Args=<none>
Nested Error:
<none>
ORA-06512: at "PIN10.PIN_REL", line 4898
ORA-20015: precommit failed (with exception): 18838741
ORA-06512: at "PIN10.PIN_REL", line 4260
ORA-29532: Java call terminated by uncaught Java exception: DeterminateError - ERR_BAD_OPCODE
FList.java:0: ErrBuf Fields:
Error=ERR_BAD_OPCODE Loc=DM
Field=PIN_FLD_OP_SQL_TRACE Rec=0 reserved=35
Facility=0 MessageID=0 Time=4:00 PM Version=0 Reserved2=0
Error 02/28/16 10:46:56:0571 PM ( 1456728416575 ) T:main REL IREL 1:ece:UnknownProgramName:0:main:1:1456728415:0
Error encountered in the Update Stored Procedure: 8003
The update stored procedure encountered an error on an update statement.
Error 02/28/16 10:46:56:0575 PM ( 1456728416575 ) T:main REL IREL 1:ece:UnknownProgramName:0:main:1:1456728415:0
Exiting with return code: 8
One of the suggestion was to execute below listed .plb files present in pin_rel directory
pin_rel_tt_pre_updater_sp.plb*
pin_rel_updater_sp_oracle.plb*
suspense_updater_sp_oracle.plb*
pin_rel_tt_updater_sp.plb*
But this solution didn't work. Only event related tables are loaded, Item tables aren't populated.
set the ObjectCacheTypeOutputSplit to FALSE in pipeline registery. If this field is set to TRUE it will result in 2 identical output files from a single input EDR and write them to separate output streams.

How to show only error message oracle raise application error

I am writing oracle triggers and i have some error messages.
I use this code for handling error:
raise_application_error(-20001, 'error message, please do not this');
But this shows very lot info;
For example:
ora-20001: <<custom message>>.
ora-06512: at <<package.procedure_name>>, line 100
I want only show error message body: "error message, please do not this"
Is there a way to do this?
Since I found this question pretty high in my Google search, here is a simple method to just get the error message:
declare
procedure test is
begin
raise_application_error(-20222, 'This is an error');
end test;
begin
test;
exception
when others then
dbms_output.put_line(replace(sqlerrm, 'ORA' || sqlcode || ': ', ''));
end;
Will output:
This is an error
DBMS_OUTPUT.PUT_LINE(REGEXP_REPLACE(SQLERRM, '^ORA-[0-9]+: ', ''));
You can use the SQLERRM function, which will return the exception number and the message, without the lines. There's no function for returning only the text, but you can use SQLCODE function to do that like the second example in this article.
Just remember that this data is mainly intended to help you to cope with unexpected situations in debugging, logging, etc., so most of the time you should consider writing all of the exception info to your log.

How to parse this JSON where name has ','

I run next example
declare
obj json := json('{"TR,A" : "OK" }');
begin
dbms_output.put_line(JSON_EXT.GET_STRING (obj, 'TR,A'));
end;
and receive a message
ORA-20110: JSON Path parse error: expected . or [ found , at position 4
ORA-06512: at "SCOTT.JSON_EXT", line 193
ORA-06512: at "SCOTT.JSON_EXT", line 201
What is the work around?
The following code works for me:
declare
my_json json := json('{"TR,A" : "OK" }');
begin
dbms_output.put_line(my_json.get('TR,A').to_char);
end;
You should work directly with the JSON type. You should only have to resort to using packages like JSON_EXT if the type methods are insufficient for your use case.

BCB: from BDE to dbexpress, BCD exception

I'm having some problem about TSQLStoredProcedure. Here is the code:
storedproc->ParamByName("A")->AsInteger = adataset->FieldByName("AA")->AsInteger;
storedproc->ExecProc();
param "A" is declared integer in the form (and it's 29 in the program). Also the stored procedure has no errors. I'm sure of it. Database is Oracle 11g. By the way, as storedproc is executed an exception occurred:
...
EBcdException with message '<0000001:000000010000000:00000063612>' is not a valid BCD value
...
All was working fine with BDE but now, using dbexpress, there is this problem. I searched over the internet for some days and I did not find an answer.
I thank you in advance and beg a pardon for my English.
Francesco
Update
I searched over the web. I found something interesting at:
https://forums.codegear.com/thread.jspa?messageID=43223&tstart=0
http://www.delphigroups.info/2/8/750511.html
I decide to make some test:
SQLQuery->ParamByName("f1")->AsString = Edit1->Text;
SQLQuery->ExecSQL();
It works. Not the same for
SQLQuery->ParamByName("f1")->AsInteger = StrToInt(Edit1->Text); //ERROR DBX Error: Invalid Field Type.
SQLQuery->ParamByName("f1")->AsFloat = StrToFloat(Edit1->Text); //ERROR DBX Error: Invalid Field Type.
SQLQuery->ParamByName("f1")->AsBCD = StrToInt(Edit1->Text); //ERROR ORA-06502: PL/SQL: error: ... ORA-06512: at line 1.
SQLQuery->ParamByName("f1")->AsFMTBCD = StrToBcd(Edit2->Text); //ERROR ORA-06502: PL/SQL: error: ... ORA-06512: at line 1.
or by using TSQLStoredProc.
So now I call my pl/sql stored proc by TSQLQuery. I use "AsString" to pass values to parameters. Weird. How does dbexpress map types? Thanks in advance.

Resources