1

I am using Oracle 11g. I created a table test_id with id(int), test_xml(clob) columns. And I just created a simple insert procedure, and try to insert some values to the table using the procedure. But it make some errors. I don't know how to fix it. I'm newer one to Oracle. Can anyone help me to fix this.

My Stored procedure is:

CREATE OR REPLACE 
PROCEDURE sp_insert_xml
(
p_id IN INT,
p_xml IN clob
)
AS
BEGIN
INSERT INTO TEST_ID VALUES (p_id, p_xml);
END;

And it throws the error:

[SQL] execute SP_INSERT_XML(1, '<root><CUSTOMERS><CustomerName>Company, Inc.1</CustomerName><GroupNumber>9340</GroupNumber><memberCount>6291</memberCount><OutlierPercentDifference>20</OutlierPercentDifference><ReportingPeriod>Q4 2012 - Q3 2013</ReportingPeriod><PreviousReportingPeriod>Q4 2011 - Q3 2012</PreviousReportingPeriod><ReportingYear>2013</ReportingYear></CUSTOMERS></root>')
[Err] ORA-00900: invalid SQL statement

Thanks in advice

2 Answers 2

2

I simulated your case and it works for me. Maybe is the way as you are calling your procedure.Try like this:

begin
sp_insert_xml(1, '<root><CUSTOMERS><CustomerName>Company, Inc.1</CustomerName>
<GroupNumber>9340</GroupNumber><memberCount>6291</memberCount>
<OutlierPercentDifference>20</OutlierPercentDifference>
<ReportingPeriod>Q4 2012 - Q3 2013</ReportingPeriod>
<PreviousReportingPeriod>Q4 2011 - Q3 2012</PreviousReportingPeriod>
<ReportingYear>2013</ReportingYear></CUSTOMERS></root>');
end;
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, It's working. I think you tell me to call the PL/SQL block. Thanks for your advice Aramillo
0

There is no execute command. Try:

call SP_INSERT(...);

or

begin
   sp_insert(...);
end;
/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.