-
wrong number of data type error
Hi,
I trying to complie the following PL/SQL code below which is throwing xml error.
Oracle Version: 9i
Windows NT
set serveroutput on
declare
l_bfile BFILE;
rec chrt_visit%rowtype;
last_vid number;
fromdate date := TO_DATE('11/11/2008', 'MM/DD/YYYY');
minVisitID number := 0;
--script variables
p dbms_xmlparser.parser;
doc dbms_xmldom.DOMDocument;
el dbms_xmldom.DOMElement;
node dbms_xmldom.DOMNode;
node1 dbms_xmldom.DOMNode;
result_doc varchar2(32000);
l_n dbms_xmldom.DOMNode;
elmt xmldom.DOMElement;
item_text xmldom.DOMText;
item_node xmldom.DOMNode;
item_Attr xmldom.DOMAttr;
item_Field xmldom.DOMNode;
buffer_problem varchar2(2000);
parser xmlparser.parser;
v_clob CLOB;
v_patientname varchar(100);
--long ops
rindex BINARY_INTEGER;
slno BINARY_INTEGER;
totalwork number;
sofar number;
obj BINARY_INTEGER;
begin
l_bfile := BFileName ('XML_DIR', 'users.xml');
rindex := dbms_application_info.set_session_longops_nohint;
sofar := 0;
select count(*) into totalwork from chrt_visit where arrival_time between fromdate and fromdate+1 and visit_state_id = 2007;
for rec in ( select visit_id, person_id, arrival_time, his_account_number from chrt_visit where arrival_time between fromdate and fromdate+1 and visit_state_id = 2007 order by visit_id) loop
last_vid := rec.visit_id;
sofar := sofar + 1;
dbms_session.set_nls('NLS_DATE_FORMAT','''MON/DD/YYYY''');
dbms_application_info.set_session_longops(rindex, slno, 'ECNameFix', rec.visit_id, 0, sofar, totalwork, trunc(rec.arrival_time), '(Last Visit_ID :' || rec.visit_id || ')');
--Change Number Below to Continue from a Specific Visit ID
if( last_vid <= minVisitID ) then
dbms_output.put_line( 'Skipping : VisitID' || rec.visit_id || ' Account :' || rec.his_account_number);
else
for vobid in ( SELECT VISIT_OBSERVATION_ID FROM CHRT_VISIT_OBSERVATION WHERE VISIT_ID = rec.visit_id and external_data_source = 'ecpen') loop
dbms_output.put_line( 'Processing : VisitID' || rec.visit_id || ' VOB ID :' || vobid.VISIT_OBSERVATION_ID);
SELECT CLINICAL_FINDING INTO v_clob FROM CHRT_VISIT_OBSERVATION WHERE VISIT_OBSERVATION_ID = vobid.VISIT_OBSERVATION_ID;
p := dbms_xmlparser.newParser;
dbms_xmlparser.parseBuffer(p,v_clob);
doc := dbms_xmlparser.getDocument(p);
dbms_xmldom.setVersion(doc, '1.0');
l_n := dbms_xslprocessor.selectSingleNode(xmldom.makeNode(doc),'/Form/FormData/Field[@Name="*Patient.PTName"]/Type/text()');
if dbms_xmldom.getnodeValue(l_n) = 1 Then
dbms_output.put_line('PATIENT NAME EXISTS');
else
dbms_output.put_line('PATIENT NAME DOES NOT EXISTS');
SELECT FAMILY_NAME || ', ' || GIVEN_NAME INTO v_patientname FROM PT_PERSON WHERE PERSON_ID = rec.PERSON_ID;
l_n := dbms_xslprocessor.selectSingleNode(xmldom.makeNode(doc),'//Form/FormData');
xmlparser.freeparser (parser);
elmt := xmldom.createElement(doc, 'Field');
item_Field := xmldom.appendChild(l_n, xmldom.makeNode(elmt));
item_Attr := xmldom.createAttribute( doc, 'attrib');
xmldom.setAttribute( elmt, 'Name', '*Patient.PTName');
elmt := xmldom.createElement(doc, 'Type');
item_node := xmldom.appendChild(item_Field, xmldom.makeNode(elmt));
item_text := xmldom.createTextNode(doc, '1');
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
elmt := xmldom.createElement(doc, 'Value');
item_node := xmldom.appendChild(item_Field, xmldom.makeNode(elmt));
item_text := xmldom.createTextNode(doc, v_patientname);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
elmt := xmldom.createElement(doc, 'Confidence');
item_node := xmldom.appendChild(item_Field, xmldom.makeNode(elmt));
item_text := xmldom.createTextNode(doc, '1.0');
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
elmt := xmldom.createElement(doc, 'Attributes');
item_node := xmldom.appendChild(item_Field, xmldom.makeNode(elmt));
xmldom.writetobuffer(doc, buffer_problem);
DBMS_LOB.createtemporary(v_clob, FALSE);
DBMS_LOB.writeappend (v_clob, LENGTH (buffer_problem), buffer_problem);
dbms_output.put_line(v_clob);
xmldom.freeDocument(doc);
--UPDATE CHRT_VISIT_OBSERVATION SET CLINICAL_FINDING = v_clob WHERE VISIT_OBSERVATION_ID = vobid.VISIT_OBSERVATION_ID;
COMMIT;
End if;
end loop;
COMMIT;
dbms_lock.sleep(10);
end if;
end loop;
end;
/
exit;
/
Here is the error that I got when compiling the code:
ERROR at line 58:
ORA-06550: line 58, column 48:
PLS-00306: wrong number or types of arguments in call to 'MAKENODE'
ORA-06550: line 58, column 6:
PL/SQL: Statement ignored
ORA-06550: line 67, column 50:
PLS-00306: wrong number or types of arguments in call to 'MAKENODE'
ORA-06550: line 67, column 8:
PL/SQL: Statement ignored
ORA-06550: line 70, column 16:
PLS-00306: wrong number or types of arguments in call to 'CREATEELEMENT'
ORA-06550: line 70, column 8:
PL/SQL: Statement ignored
ORA-06550: line 71, column 22:
PLS-00306: wrong number or types of arguments in call to 'APPENDCHILD'
ORA-06550: line 71, column 8:
PL/SQL: Statement ignored
ORA-06550: line 72, column 21:
PLS-00306: wrong number or types of arguments in call to 'CREATEATTRIBUTE'
ORA-06550: line 72, column 8:
PL/SQL: Statement ignored
ORA-06550: line 75, column 16:
PLS-00306: wrong number or types of arguments in call to 'CREATEELEMENT'
ORA-06550: line 75, column 8:
PL/SQL: Statement ignored
ORA-06550: line 77, column 21:
PLS-00306: wrong number or types of argume
Thanks.
EK
-
Unfortunately I can't tell you specifically what the errors are caused by. However, you have a lot going on in this procedure. You should really make this a package and split it out into smaller self contained procedures. Add a small amount of logic, and make it work, then add a little more and make it work, etc.
IMHO, You are creating something that is going to be hard to manage.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|