Home » SQL & PL/SQL » SQL & PL/SQL » Wrong number of arguments being passed into child element (O/S:Windows 7 PRO; Product: Oracle; version: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production)
Wrong number of arguments being passed into child element [message #637028] Thu, 07 May 2015 15:23 Go to next message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
I am working from a support perspective and considering that XML is very new to me, I am trying to fix this function. The code is as follows:

FUNCTION BuildCPRHeader  RETURN VARCHAR2
IS
			vpublishHdr VARCHAR2(2000) := NULL;
            
		BEGIN
		--	child_elmt := xmldom.createElement(doc, 'PUBLISH_HEADER');
			--child_node  := xmldom.appendChild (root_node, xmldom.makeNode (child_elmt));

			child_elmt := xmldom.createElement (doc, 'SOURCE_APLCTN_ID');
			elmt_value := xmldom.createTextNode (doc, 'CTN');
			leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
			leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
			
			child_elmt := xmldom.createElement (doc, 'SOURCE_PRGRM_ID');
			elmt_value := xmldom.createTextNode (doc, 'VALUE');
			leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
			leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));

			child_elmt := xmldom.createElement (doc, 'SOURCE_CMPNT_ID');
			elmt_value := xmldom.createTextNode (doc, 'VALUE');
			leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
			leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));

			child_elmt := xmldom.createElement (doc, 'PUBLISH_TMS');
			elmt_value := xmldom.createTextNode (doc, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS'));
			leaf_node  := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
			leaf_node  := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));

			vPublishHdr := TO_CHAR(child_elmt);
			
			RETURN vPublishHdr;
            
END BuildCPRHeader;


When I try to compile I am getting hit with an error that says:
PLS-00306:Wrong number of arguments in call TO_CHAR


TO_CHAR obviously not take an object of "XMLDOM.CREATEELEMENT" as this built in returns a DOM object. How do I get around this issue???Any thought or help much appreciated.
Re: Wrong number of arguments being passed into child element [message #637038 is a reply to message #637028] Thu, 07 May 2015 17:07 Go to previous messageGo to next message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
Issue fixed. Thanks.
Re: Wrong number of arguments being passed into child element [message #637040 is a reply to message #637038] Fri, 08 May 2015 01:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

What was it? How did you fix it?

Re: Wrong number of arguments being passed into child element [message #637048 is a reply to message #637040] Fri, 08 May 2015 07:56 Go to previous messageGo to next message
buggleboy007
Messages: 282
Registered: November 2010
Location: Canada
Senior Member
Michel Cadot wrote on Fri, 08 May 2015 01:17

What was it? How did you fix it?



by reading Oracle's fine manual and tweaking the function that I was using.

BTW - U and others suggested me to use CLOB variable (if u recall in other previous discussions). If you had read my code, the issue was not with the CLOB. I was indeed using a CLOB variable and retrieving the results of the query and generating it into an XML by using "dbms_xmlgen.getxmltype" . The problem that I was facing was after storing the results of the generation (which was being stored in CLOB), where in I was trying to create a text node. The issue was here... with create text node it has a limitation of 32K and mine exceeded 32K because of which I was getting it by a run time error. The solution applied was to generate the whole clob into an XML file and allow C language to pick it up from the place where it generated the file. I don't think you and BlackSwan took a look into the code rather just kept telling me about how clumsy my code was.

Anyways thanks for all your suggestions and criticisms. Much appreciated... and A SPECIAL THANKS TO BLACKSWAN WHO PRIVATE MESSAGES ME AND HAS BLOCKED MY PRIVILEGES to PM him.
Re: Wrong number of arguments being passed into child element [message #637052 is a reply to message #637048] Fri, 08 May 2015 10:23 Go to previous message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I don't think I told you "how clumsy your code was" as I agree with you I didn't have a single look at it (as I can't execute it).
You posted 3 or 4 topics around the same thing at about the same time (and one named "How to convert CLOB(results of an SQL query) to XMLDocument"), you confuse us and you just have to put a blame on you to not correctly explain your problem.

Next time, you will take more time to post your question and explain the problem, showing us what you do and get and posting something we can reproduce.

Anyway thanks for the feedback.

[Updated on: Fri, 08 May 2015 11:32]

Report message to a moderator

Previous Topic: Frequency Distribution with future date place holders
Next Topic: PRAGMA EXCEPTION_INIT not working as desired
Goto Forum:
  


Current Time: Tue Apr 23 06:15:20 CDT 2024