To use ODBC from within a Tcl script add the folowing line:
package require tclodbc
then connect to ODBC using:
database db $dsn
You will have to configure the ODBC DSN manually, to point to your database, assuming the Oracle driver is there!
Hope this helps.
----
I solved my problem shortly after I posted the message. Most of the 'write' examples I got from the \Tcl8.3\lib\tclodbc2.3\samples folder. A typical 'write' statement is shown below, any output SQL statement is placed between the double quotes:
$db "CREATE TABLE tblRodDropData (
TripID int,
ObjectId varCHAR (40),
RSC varchar(40),
LogIndex int,
Date varCHAR (12),
Time varCHAR (12),
Hundreths int,
Value int
)"
Reading data turned out to be quite simple by using statements like the following, which drops all user tables whose name starts with 'tbl':
proc drop_tables { db } {
foreach i [db "SELECT Name from sysobjects WHERE name like 'tbl%' and type = 'U'"] {
$db "DROP table $i"
.lb insert 0 "Dropped table $i"
}
}
Regards,
Phil Johnson
Senior Software Engineer, Capula Limited