We help IT Professionals succeed at work.
Get Started

Error Calling SQL from Unix with dbms_xmlgen.getxml()

srikanthradix
on
2,579 Views
Last Modified: 2012-05-05
I have written a function in Unix which executes SQL. Please find the function in code snippet.

I copied the sql statement as is from there into TOAD. It is working perfectly fine by returning 7 rows.

When i execute this script in Unix, i am getting the following error. Please suggest.

ERROR:
ORA-19202: Error occurred in XML processing
ORA-24333: zero iteration count
ORA-06512: at "SYS.DBMS_XMLGEN", line 176
ORA-06512: at line 1

no rows selected
ExecuteSQL()
{
 
sql_query=""
 
sql_query=$1
 
if [ "$sql_query" != "" ]
then
 
sqlplus -s $dbuser/$dbpass << END_OF_SQL
 
set pages 0;
set linesize 285;
set long 999999999;
set head off;
spool $logdir/$fileName;
 
select dbms_xmlgen.getxml( '$sql_query' )xmlrow from dual;
 
spool off;
/
END_OF_SQL
 
fi
 
}
 
sql="select * from table where to_date(moddate,'DD-MON-YY') in to_date('12-FEB-08','DD-MON-YY')"
 
ExecuteSQL sql 1 > $logdir/temp.xml 2 > $logdir/error.log

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE