📄 cursorerrors.out
字号:
ij> -- What happens when language exceptions are thrown on a next?-- NOTE: this test is dependent on no optimization, i.e., always getting-- the same access methods (table scans and join order matching the from list)-- create the tablescreate table t1 (c1 int);0 rows inserted/updated/deletedij> create table t2 (c1 int);0 rows inserted/updated/deletedij> -- populate the tablesinsert into t1 values 1, 0, 2;3 rows inserted/updated/deletedij> insert into t2 values 1, 0, 2;3 rows inserted/updated/deletedij> autocommit off;ij> -- What happens on a fetch after a divide by 0 error?-- error in select list-- single table queryget cursor c1 as 'select c1, c1/c1 from t1';ij> next c1;C1 |2 -----------------------1 |1 ij> -- divide by 0next c1;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c1;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c1;ij> -- join #1get cursor c2 as 'select a.c1, b.c1, a.c1/a.c1 from t1 a, t1 b where a.c1 = b.c1';ij> next c2;C1 |C1 |3 -----------------------------------1 |1 |1 ij> -- divide by 0next c2;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c2;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c2;ij> -- join #2get cursor c3 as 'select a.c1, b.c1, b.c1/a.c1 from t1 a, t1 b';ij> next c3;C1 |C1 |3 -----------------------------------1 |1 |1 ij> next c3;C1 |C1 |3 -----------------------------------1 |0 |0 ij> next c3;C1 |C1 |3 -----------------------------------1 |2 |2 ij> -- divide by 0next c3;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c3;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c3;ij> -- union allget cursor c4 as 'select c1, c1/c1 from t1 union all select c1, c1/c1 from t1';ij> next c4;C1 |2 -----------------------1 |1 ij> -- divide by 0 on left sidenext c4;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c4;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c4;ij> -- error in where clause-- single tableget cursor c10 as 'select * from t1 where c1/c1 = 1';ij> -- (1)next c10;C1 -----------1 ij> -- divide by 0next c10;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c10;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c10;ij> -- join #1, error on open (1st row in left)-- (cursor will not exist after error on open)get cursor c12 as 'select * from t1 a, t1 b where a.c1 <> 1 and a.c1/a.c1 = 1';ERROR 22012: Attempt to divide by zero.ij> -- next should fail, since no cursornext c12;IJ ERROR: Unable to establish cursorij> -- join #2, error on 2nd row on leftget cursor c13 as 'select * from t1 a, t1 b where b.c1 = 1 and a.c1/a.c1 = 1';ij> -- (1, 1)next c13;C1 |C1 -----------------------1 |1 ij> -- divide by 0 from leftnext c13;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c13;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c13;ij> -- join #3, error on 1st row in rightget cursor c14 as 'select * from t1 a, t1 b where b.c1 <> 1 and b.c1/b.c1 = 1';ij> -- divide by 0 from rightnext c14;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c14;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c14;ij> -- join #4, error on 2nd row in rightget cursor c15 as 'select * from t1 a, t1 b where b.c1 <> 2 and b.c1/b.c1 = 1';ij> -- (1, 1)next c15;C1 |C1 -----------------------1 |1 ij> -- divide by 0 from rightnext c15;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c15;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c15;ij> -- union allget cursor c11 as 'select * from t1 where c1/c1 = 1 union all select * from t1 where c1/c1 = 1';ij> -- (1) from leftnext c11;C1 -----------1 ij> -- divide by 0 from leftnext c11;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c11;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c11;ij> -- error in join clauseget cursor c5 as 'select * from t1, t2 where t1.c1/t2.c1 = 1';ij> -- (1, 1)next c5;C1 |C1 -----------------------1 |1 ij> -- (1, 0) -> divide by 0next c5;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c5;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c5;ij> -- error in subquery-- subquery in select list-- single table queryget cursor c8 as 'select c1, (select c1/c1 from t2 where t1.c1 = c1) from t1';ij> -- (1, 1)next c8;C1 |2 -----------------------1 |1 ij> -- divide by 0next c8;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c8;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c8;ij> -- joinget cursor c9 as 'select a.c1, (select c1/c1 from t2 where c1 = a.c1) from t1 a, t1 b where a.c1 = b.c1';ij> -- (1, 1)next c9;C1 |2 -----------------------1 |1 ij> -- divide by 0next c9;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c9;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c9;ij> -- subquery in where clause-- single table queryget cursor c6 as 'select * from t1 where c1 = (select c1/c1 from t2 where t1.c1 = c1) or c1 = 2';ij> -- (1)next c6;C1 -----------1 ij> -- divide by 0next c6;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c6;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c6;ij> -- joinget cursor c7 as 'select * from t1 a, t1 b where a.c1 = b.c1 and (a.c1 = (select c1/c1 from t2 where a.c1 = c1) or a.c1 = 2)';ij> -- (1, 1)next c7;C1 |C1 -----------------------1 |1 ij> -- divide by 0next c7;ERROR 22012: Attempt to divide by zero.ij> -- Verify that cursor closed on errornext c7;ERROR XCL16: ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.ij> close c7;ij> -- drop the tablesdrop table t1;0 rows inserted/updated/deletedij> drop table t2;0 rows inserted/updated/deletedij>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -