Note that there are some explanatory texts on larger screens.

plurals
  1. POoratcl ORA-24338: statement handle not executed
    primarykey
    data
    text
    <p>Simple example using oratcl:</p> <h1>Create Table and simple package</h1> <pre><code>CREATE TABLE test (id INTEGER,val INTEGER); INSERT INTO test (id,val) values (1,10); INSERT INTO test (id,val) values (2,20); INSERT INTO test (id,val) values (3,30); INSERT INTO test (id,val) values (4,40); CREATE OR REPLACE PACKAGE tst is FUNCTION get_test RETURN sys_refcursor; END; / CREATE OR REPLACE PACKAGE BODY tst is FUNCTION get_test RETURN sys_refcursor IS retval sys_refcursor; BEGIN OPEN retval FOR SELECT * FROM test ORDER BY id; RETURN retval; END; END; / </code></pre> <h1>Tcl functions are below:</h1> <pre><code>package require Oratcl proc getLoginStr {} { set userName "xxx" set password "xxxx" set db "xxx" append retval $userName "/" $password "@" $db } set _lda "" set _sqlH "" proc init {} { global _lda global _sqlH set _lda [oralogon [getLoginStr]] set _sqlH [oraopen $_lda] } proc prepare {} { global _sqlH set Sql { begin :retval := tst.get_test(); end; } ::db_ora::parseSql $_sqlH $Sql } proc go {} { global _lda global _sqlH set curH [oraopen $_lda] set pv_lst [list :retval $curH] orabind $_sqlH :retval $curH oraexec $_sqlH set retval "" while {[orafetch $curH -datavariable row] == 0} { puts "row : $row" lappend retval $row } return $retval } </code></pre> <h1>Run following script once:</h1> <pre><code>source test.tcl init prepare go </code></pre> <h2>Output:</h2> <pre><code>row : 1 10 row : 2 20 row : 3 30 row : 4 40 {1 10} {2 20} {3 30} {4 40} </code></pre> <h1>re-Run go procedure</h1> <pre><code>go </code></pre> <h2>Output:</h2> <pre><code>row : row : row : row : row : row : row : row : row : row : ORA-24338: statement handle not executed </code></pre> <p>Any Ideas? Why script did not work on re-run? If I am not mistaken it should reuse the opened handle _SqlH.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload