About ORA-01002 read violation order

Source: Internet
Author: User

Today, the following error occurs when you run your own JDBC to call the stored procedure:
ORA-01002 read violation order
Most of the suggestions provided on the Internet are to set Automatic SQL submission to false: cn. setAutoCommit (false );
But this is not where my error is located. I did not set it when I finally solved it.
My stored procedure is as follows:
Create or replace procedure tag (outs out sys_refcursor) is
Allout sys_refcursor;
Id varchar2 (16 );
Mid varchar2 (16 );
Tty varchar2 (16 );
Cty varchar2 (16 );
Tid varchar2 (16 );
Tna varchar2 (16 );
Tva varchar2 (16 );
Tsi varchar2 (16 );
Tti varchar2 (16 );
Pid varchar2 (16 );
Nex varchar2 (16 );
Gra char (4 );
Begin
Open allout for select id, module_id, tag_type, control_type, tag_id, tag_name, tag_value, tag_size, tag_title, parent_id, next, grade
Into id, mid, tty, cty, tid, tna, tva, tsi, tti, pid, nex, gra from t_tag;
-- Loop
-- Fetch allout into id, mid, tty, cty, tid, tna, tva, tsi, tti, pid, nex, gra;
-- Exit when allout % notfound;
-- Dbms_output.put_line (allout % rowcount | ''| id |'' | mid | ''| tty |'' | cty | ''| tid | ''| tna |'' | tva | ''| tsi |'' | tti | ''| pid |'' | nex | ''| gra );
-- End loop;
Outs: = allout;
End tag;
JDBC is as follows:
Cn = DBFactory. getconn ();
// Cn. setAutoCommit (false );
// System. out. println ("create Declaration ");
Cst = cn. prepareCall ("{call tag (?)} ");
System. out. println ("Execute SQL ");
Cst. registerOutParameter (1, Oracle. jdbc. OracleTypes. CURSOR );
Cst.exe cute ();
System. out. println ("execute successful ");
Rs = (ResultSet) cst. getObject (1 );
System. out. println (rs );
While (rs. next ()){
}
My error lies in the usage
Loop
Fetch
The end loop carries out the cyclic value, but when calling the stored procedure in JDBC, you only need to return a result set (cursor). In this case, the error "read violation order" is reported, solution: Remove loop .... end loop code.

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.