Unix Technical Forum

system date/time

This is a discussion on system date/time within the Informix forums, part of the Database Server Software category; --> How would I select just the system date/time from an Informix datebase. For example, in Oracle it would be ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 08:59 PM
kstahl
 
Posts: n/a
Default system date/time

How would I select just the system date/time from an Informix
datebase.

For example, in Oracle it would be "select sysdate from dual". I
just need the Informix equivalent.

TIA


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 08:59 PM
Jonathan Leffler
 
Posts: n/a
Default Re: system date/time

kstahl wrote:

> How would I select just the system date/time from an Informix datebase.
>
> For example, in Oracle it would be "select sysdate from dual". I just
> need the Informix equivalent.



The standard Informix idiom is:

SELECT TODAY FROM Systables WHERE Tabid = 1;

Alternatives include:

CREATE TABLE Dual
(
Number INTEGER NOT NULL CHECK(Number = 0) PRIMARY KEY
);
INSERT INTO Dual VALUES(0);
REVOKE ALL ON Dual FROM PUBLIC;
GRANT SELECT ON Dual TO PUBLIC;

SELECT TODAY FROM Dual;

If you want time as well as date, then:

SELECT CURENT FROM Dual;

And so the list goes on...

SELECT ... FROM "informix".Systables WHERE Tabid = 1

works because there is only one entry in systables with tabid = 1, and
that's the entry for systables. If that goes missing, you've got
bigger problems than that your select doesn't work any more.

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 08:59 PM
Jonathan Leffler
 
Posts: n/a
Default Re: system date/time

Jonathan Leffler wrote:
[...]
> If you want time as well as date, then:
>
> SELECT CURENT FROM Dual;


Oops - typo: CURRENT -- optionally qualified by something like YEAR TO
FRACTION(3), or MONTH TO MINUTE, or ...

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2008, 09:00 PM
kstahl
 
Posts: n/a
Default Re: system date/time

Jonathan Leffler wrote:
> Jonathan Leffler wrote:
> [...]
>
>> If you want time as well as date, then:
>>
>> SELECT CURENT FROM Dual;

>
>
> Oops - typo: CURRENT -- optionally qualified by something like YEAR TO
> FRACTION(3), or MONTH TO MINUTE, or ...
>


Ok, thanks. That just what I needed. I don't work with Informix
very often (mostly Oracle and MSSQL), but occasionally I have to
delve in and I don't have much documentation available to me.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-19-2008, 09:00 PM
June C. Hunt
 
Posts: n/a
Default Re: system date/time

kstahl wrote:
> Jonathan Leffler wrote:
> > Jonathan Leffler wrote:
> > [...]
> >
> >> If you want time as well as date, then:
> >>
> >> SELECT CURENT FROM Dual;

> >
> >
> > Oops - typo: CURRENT -- optionally qualified by something like YEAR TO
> > FRACTION(3), or MONTH TO MINUTE, or ...
> >

>
> Ok, thanks. That just what I needed. I don't work with Informix
> very often (mostly Oracle and MSSQL), but occasionally I have to
> delve in and I don't have much documentation available to me.



I tried to respond to you directly but there was an e-mail delivery failure
so I'm posting this here.

The following link will get you to the on-line IBM Informix documentation.
http://www-306.ibm.com/software/data...ary/lists.html

--
June Hunt


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-19-2008, 09:01 PM
kstahl
 
Posts: n/a
Default Re: system date/time

June C. Hunt wrote:
> I tried to respond to you directly but there was an e-mail delivery failure
> so I'm posting this here.
>
> The following link will get you to the on-line IBM Informix documentation.
> http://www-306.ibm.com/software/data...ary/lists.html
>
> --
> June Hunt
>
>

My email address is purposefully munged (in an obvious sort of
way if you look at it closely enough) to prevent abuse by spam
harvesters.

I had looked at the on-line documentation but it seemed to be
leading me in so many different directions that I figured I would
just come here and ask people who have experience.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-19-2008, 09:02 PM
Ferronato
 
Posts: n/a
Default Re: system date/time

Hi,

If you run the statement:
SELECT CURRENT from systables where tabid = 1 ;
it will returns the current date and time, as everybody said to you.

But, if the "fraction" of seconds allways becomes 0 , see your
onconfig file the parameter:
USEOSTIME
If it is 0 (zero), the IDS don't 'ask' to the operational system the
right time.
IF it is 1 every time when it is called, the IDS makes a 'call' to the
operational system to get it. Is because that the performance can goes
down.

Best regards .... R. Ferronato

kstahl <ktsahl@yahoo.com> wrote in message news:<OrWdnVhmVvCIuJLd4p2dnA@comcast.com>...
> How would I select just the system date/time from an Informix
> datebase.
>
> For example, in Oracle it would be "select sysdate from dual". I
> just need the Informix equivalent.
>
> TIA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-19-2008, 09:02 PM
kstahl
 
Posts: n/a
Default Re: system date/time

Ferronato wrote:

> Hi,
>
> If you run the statement:
> SELECT CURRENT from systables where tabid = 1 ;
> it will returns the current date and time, as everybody said to you.
>
> But, if the "fraction" of seconds allways becomes 0 , see your
> onconfig file the parameter:
> USEOSTIME
> If it is 0 (zero), the IDS don't 'ask' to the operational system the
> right time.
> IF it is 1 every time when it is called, the IDS makes a 'call' to the
> operational system to get it. Is because that the performance can goes
> down.
>
> Best regards .... R. Ferronato
>
> kstahl <ktsahl@yahoo.com> wrote in message news:<OrWdnVhmVvCIuJLd4p2dnA@comcast.com>...
>
>>How would I select just the system date/time from an Informix
>>datebase.
>>
>>For example, in Oracle it would be "select sysdate from dual". I
>>just need the Informix equivalent.
>>
>>TIA


I only need accuracy to the second, so fractional portions of
seconds won't affect what I'm doing. Ultimately I'm really only
interested in detecting whether the system time in the database
is in standard time or DST.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com