For Programmers: Free Programming Magazines  


Home > Archive > Tcl > June 2006 > tcl sql selecting and retrieving selected fields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author tcl sql selecting and retrieving selected fields
crist-y

2006-06-19, 8:03 am

hi
i would like to retrive two columns from a table, select the last
recording and memorise them within two variables
the structure of my table is
Node, LogDate, LogTime, LogName, FirstValue, LastValue,..........
I'm interested in the LogDate and LogTime recordings
What I use doesn't seem to work

SQLDIRECT "CONNECT SESSSION 3 TO kerw_ACCESS"
SQLDIRECT "USE SESSION 3"
SQLDIRECT "DECLARE CURSOR C3"
SQLPREPARE "SELECT (LogDate, LogTime) FROM BwAnalogTable"
SQLPREPARE "ORDER BY BwAnalogTable.LogTime DESC"
SQLEXECUTE
SQLDIRECT "OPEN C3"
SQLDIRECT "FETCH C3 INTO Mem_DateWA, Mem_TimeWA"
set M [list Mem_DateWA Mem_TimeWA"
SQLDIRECT "CLOSE C3"
SQLDIRECT "DISCONNECT SESSION 3"

Thanx

Gerald W. Lester

2006-06-19, 7:22 pm

crist-y wrote:
> hi
> i would like to retrive two columns from a table, select the last
> recording and memorise them within two variables
> the structure of my table is
> Node, LogDate, LogTime, LogName, FirstValue, LastValue,..........
> I'm interested in the LogDate and LogTime recordings
> What I use doesn't seem to work


You may find you get better answers faster if you tell us what error message
you are getting or what exactly the program is doing that is unexpected.
"doesn't seem to work" is rather vague.

> SQLDIRECT "CONNECT SESSSION 3 TO kerw_ACCESS"
> SQLDIRECT "USE SESSION 3"
> SQLDIRECT "DECLARE CURSOR C3"
> SQLPREPARE "SELECT (LogDate, LogTime) FROM BwAnalogTable"
> SQLPREPARE "ORDER BY BwAnalogTable.LogTime DESC"
> SQLEXECUTE
> SQLDIRECT "OPEN C3"
> SQLDIRECT "FETCH C3 INTO Mem_DateWA, Mem_TimeWA"
> set M [list Mem_DateWA Mem_TimeWA"


You are missing the close square bracket, not sure if this is a typo in your
post or your problem.

> SQLDIRECT "CLOSE C3"
> SQLDIRECT "DISCONNECT SESSION 3"


You do realize that the following commands are *not* part of Tcl but rather
part of some extension that you are using but did not tell us about :
SQLDIRECT, SQLPREPARE, and SQLEXECUTE


--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Michael Schlenker

2006-06-19, 7:22 pm

Gerald W. Lester schrieb:
> crist-y wrote:
>
> You may find you get better answers faster if you tell us what error
> message you are getting or what exactly the program is doing that is
> unexpected. "doesn't seem to work" is rather vague.
>
>
> You are missing the close square bracket, not sure if this is a typo in
> your post or your problem.
>
>
> You do realize that the following commands are *not* part of Tcl but
> rather part of some extension that you are using but did not tell us about :
> SQLDIRECT, SQLPREPARE, and SQLEXECUTE
>
>

probably oratcl...

Michael
Gerald W. Lester

2006-06-19, 7:22 pm

Michael Schlenker wrote:
> Gerald W. Lester schrieb:
> probably oratcl...


In that case they are procedures which do who knows what, since oratcl
commands are:
orasql, oraprepare, oraexec, orabind, and orabindexec

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
crist-y

2006-06-24, 8:23 am

It's a Web based supervision software
what i'm interested about is rather the tcl part of it
thanx for your input
> +------------------------------------------------------------------------+


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com