[Bigloo-lib-devel] Question on RDBMS
Status: Beta
Brought to you by:
wowa
|
From: Nuzzo Art-C. <A....@mo...> - 2004-04-21 13:23:58
|
I am having a problem with data format using RDBMS. I am running bigloo-lib-0.20 with bigloo2.6c on an HP-UX 11.11 system running Oracle 8.1.7.
Data fields that are defines as just NUMBER and no data format are displayed as an integer. This differs from how Oracle will output it. For example:
SQL> desc person
Name Null? Type
------------------------------- -------- ----
ID NOT NULL NUMBER(38)
LAST_NAME CHAR(20)
FIRST_NAME CHAR(20)
AGE NUMBER
SAVINGS NUMBER(8,3)
(prepare sess "select id, last_name, first_name, age, savings, savings/age Ratio from person")
<mailto:artn@bs713> artn@bs713> bigloo-rdbms rdbms1.scm
(100 "Tsichevski " "Vladimir " 14 1000.3300170898 68)
(101 "Taranoff " "Alexander " 15 12345.673828125 781)
(102 "Ananin " "Vladimir " 16 20394.345703125 1210)
<mailto:artn@bs713> artn@bs713>
ID LAST_NAME FIRST_NAME AGE SAVINGS RATIO
---------- -------------------- -------------------- ---------- ---------- ----------
100 Tsichevski Vladimir 14.5 1000.33 68.9882759
101 Taranoff Alexander 15.8000002 12345.674 781.371763
102 Ananin Vladimir 16.8449993 20394.346 1210.70625
Note that the age and RATIO are output as an integer from RDBMS yet Oracle will output those fields as a decimal number.
I am trying to use RDBMS to monitor oracle system tables so modifying the data format for the table is not possible.
Is there something I am doing wrong?
I have included the scheme code below.
Thanks for any help,
Art Nuzzo
a....@mo... <mailto:a....@mo...>
;;; compile: bigloo -c -O +rm rdbms1.scm -o rdbms1.o; bigloo rdbms1.o -o rdbms1
;;; interpret: bigloo-rdbms rdbms1.scm
(module foo
(library common rdbms)
(main main)
(eval (export-all))
)
(define (main argv)
(define conn
(rdbms-connect "oracle" username: "scott" password: "tiger"))
(define sess (acquire conn))
; (print(rdbms-drivers))
(prepare sess
"create table person (
id INTEGER PRIMARY KEY,
last_name CHAR(20),
first_name CHAR(20),
age number,
Savings number(8,3)
)")
(execute sess)
(prepare sess "insert into person values(:1,:2,:3,:4,:5)")
(bind! sess '(100 "Tsichevski" "Vladimir" 14.5 1000.33))
(execute sess)
(bind! sess '(101 "Taranoff" "Alexander" 15.8 12345.6734))
(execute sess)
(bind! sess '(102 "Ananin" "Vladimir" 16.845 20394.3452))
(execute sess)
(prepare sess "select id, last_name, first_name, age, savings, savings/age Ratio from person")
(execute sess)
(let loop ((answer-record(fetch! sess)))
(when(pair? answer-record)
(write answer-record)
(newline)
(loop (fetch! sess))))
(prepare sess "drop table person")
(execute sess)
(dismiss! conn)
)
|