From: thelfter on
Oratcl version 4.4. allows you to read/write CLOB values directly with
SQL.
Also.. There are a billion Oracle patches for Oracle 9.2.0.1.0. I
would recommend upgrading to 9.2.0.8.0

This should work...

package require Oratcl
set c [oralogon test/test(a)test]
set sth [oraopen $c]
set data [string repeat x 10000]
oraparse $sth "insert into test1 values (:v1, :v2)"
orabind $sth :v1 2 :v2 $data
oraexec $sth
oracommit $c

oraparse $sth {select * from test1}
oraexec $sth
while {[orafetch $sth -datavariable row] == 0} {


On Nov 6, 2:33 am, yahalom <yahal...(a)gmail.com> wrote:
> I work with the activeTcl documentation for oratcl but I cannot work
> properly with clob columns. for some reason the 'read' fails.
>
> I created a table:
> create table test1 (a number(2),c clob default empty_clob());
>
> I do:
> package require Oratcl
> set c [oralogon test/test(a)test]
> set sth [oraopen $c]
> orasql $sth "insert into test1 values (2,empty_clob())"
> oraparse $sth "select rowid from test1 \
>         where a = 2"
>         oraexec $sth
>         orafetch $sth -datavariable rowid
>         set data [string repeat x 10000]
>         set lobid [oralob alloc $sth -table test1 \
>         -column c -rowid $rowid]
>         oralob write $lobid -datavar data
>
>         set l [oralob length $lobid]
>         puts length-$l
>         set data ""
>         oralob read $lobid -datavar data
>         puts data2-$data
>         oraclose $sth
>         oralogoff $c
>
> as a result I get:
> length-10000
> oralob read: {ORA-21560: argument 2 is null, invalid, or out of range
> ORA-06512: at "SYS.DBMS_LOB", line 715
> ORA-06512: at line 1} ORA-21560: argument 2 is null, invalid, or out
> of range
> ORA-06512: at "SYS.DBMS_LOB", line 715
> ORA-06512: at line 1
>     while executing
> "oraplexec $stm  $pl  :rid $rowid  :lob_amt $siz  :lob_pos
> $pos  :lob_str {} "
>     while executing
> "oralob read $lobid -datavar data"
>     (file "test.tcl" line 19)
>
> what am I doing wrong?
> tcl version 8.5.4
> Oratcl 4.4
> oracle 9.2.0.1.0

From: thelfter on
Sorry for the double post. Browser operator error
From: thelfter on
On Nov 6, 2:33 am, yahalom <yahal...(a)gmail.com> wrote:
> I work with the activeTcl documentation for oratcl but I cannot work
> properly with clob columns. for some reason the 'read' fails.
>
> I created a table:
> create table test1 (a number(2),c clob default empty_clob());
>
> I do:
> package require Oratcl
> set c [oralogon test/test(a)test]
> set sth [oraopen $c]
> orasql $sth "insert into test1 values (2,empty_clob())"
> oraparse $sth "select rowid from test1 \
>         where a = 2"
>         oraexec $sth
>         orafetch $sth -datavariable rowid
>         set data [string repeat x 10000]
>         set lobid [oralob alloc $sth -table test1 \
>         -column c -rowid $rowid]
>         oralob write $lobid -datavar data
>
>         set l [oralob length $lobid]
>         puts length-$l
>         set data ""
>         oralob read $lobid -datavar data
>         puts data2-$data
>         oraclose $sth
>         oralogoff $c
>
> as a result I get:
> length-10000
> oralob read: {ORA-21560: argument 2 is null, invalid, or out of range
> ORA-06512: at "SYS.DBMS_LOB", line 715
> ORA-06512: at line 1} ORA-21560: argument 2 is null, invalid, or out
> of range
> ORA-06512: at "SYS.DBMS_LOB", line 715
> ORA-06512: at line 1
>     while executing
> "oraplexec $stm  $pl  :rid $rowid  :lob_amt $siz  :lob_pos
> $pos  :lob_str {} "
>     while executing
> "oralob read $lobid -datavar data"
>     (file "test.tcl" line 19)
>
> what am I doing wrong?
> tcl version 8.5.4
> Oratcl 4.4
> oracle 9.2.0.1.0


It could be the version of Oracle .... 9.2.0.1.0 is very old. There
are many patches. I would suggest 9.2.0.8.0

Also,

with oratcl 4.4 you do not have to use 'oralob'.

you can just use oraparse, orabind , oraexec directly on LOB columns.

-Todd
From: yahalom on
thanks for the reply. Is all the oralob API deprecated? It would be
helpfull to tell it in the doc. I looked at ActiveTcl API doc for tcl
8.5 and there is no mentioning of it.
From: yahalom on
I get error:
too large for bindsize
while executing
"orabind $sth :v1 2 :v2 $data "

Is this because of my old oracle?
well... looks like it is time to upgrade, I wish oracle upgrade was as
easy as mysql upgrade...