Re: Getting data to a file, and divide by zero
Posted in 1995
Niel,
several ways of doing this, the best being to do an unload and then write the
oracle sqlload control file specifying that the data is delimited by some
character. this is the cleanest way and can be accomplised by:
unload to "filename"
select *
from table;
as far as your second question, several options:
1. select your data into a temp table with an extra column for the expression.
set this to 0 then do an update after the select. for example:
select column1,column2,column3,0 answer
from table
into temp t1 with no log;update t1
set (answer)=(column2/column3)
where column3 != 0;
unload to "filename"
select *
from t1;
2. unload the data from informix without doing the divide, then load it into an
oracle table and to the divide there.
Apparently-To: RZBJ40@email.sps.mot.com
I am working with an AT&T R3 Call Management System, which uses Informix
as its database. Unfortunately, that means it's supported by AT&T's CMS
group, who really know nothing about Informix except as it pertains to
CMS' built-in reporting. Personally, I have more experience with Oracle,
so please bear with me for a minute.
I am trying to get some raw data out of Informix. I have messed around
with the isql program, and I have a few questions. With Oracle, when I
run an SQL query in SQL*Plus, I get data in a columnar format. In isql,
however, I get it turned on its side, if you know what I mean. How can I
get a stream of data, without headers or page formatting of any kind, into
a file for importing into Oracle?
A second question pertains to selecting expressions. Part of my query
involves dividing two columns, and the divisor may be zero. In Oracle, I
would use the decode() function to change any zeros in the divisor to ones
and I know I'd be safe from this problem. Is there an equivalent way to
do this in Informix?
Thanks in advance for your help.
Niel
--
|-------------------------------------------------------------------|
| Niel M. Bornstein nbornstein@plr.com |
| nbornstein@prubank.com |
---------------------------------------------------------------------
| Visit me at http://www.ticllc.net/home/niel/publicHome.html |
---------------------------------------------------------------------
| "Not all dinosaurs roll over and die. Some of 'em can run real |
| fast and bite the hell out of you." -- Anonymous, Wired |
|-------------------------------------------------------------------|