Re: Consult about functions.
Posted in 2005
Jorge Silva said: > Obnoxio, thanx for your answer; but what i need is this: > I have a DATETIME, let's say "1981/12/31 10:20:12"; if I do: > MONTH("1981/12/31 10:20:12") that will return me 12 (December), right? The > same if I do YEAR() or DAY(); that will return me 1981 and 31respectively. > But what I need now is something like MINUTE("1981/12/31 10:20:12") that > returns me 20 and the same for HOUR() and SECOND() that returns me 10 and > 12. I can't see how the statement EXTEND can help me for do that job; I > saw > the examples in the guide but I don't understand at all. > Thanx again for your time and I hope you can help me. > Adios! SELECT EXTEND(datetime_column, HOUR TO HOUR) FROM table WHERE ... SELECT EXTEND(datetime_column, MINUTE TO MINUTE) FROM table WHERE ... SELECT EXTEND(datetime_column, SECOND TO SECOND) FROM table WHERE ... > On 12/26/05, Obnoxio The Clown <obnoxio@serendipita.com> wrote: >> >> >> Jorge said: >> > >> > Hi! I'm new in this, in my work, we are migrating to Informix from >> > Oracle and I have to migrate some chunks of code and I have a problem >> > when I gotta translate the function "Extract" from Oracle to something >> > similar in Informix. This function "extract" - as the word says -, >> > extarct from a time stamp the day, month and year and the hour, >> minute >> > or second. I find the functions DAY(), MONTH() and YEAR() for do >> > something similar; but just with day, month and year; and now i need >> > this for hour, minute and second. Can someone give me a tip? >> > Thanx 4 all! >> > >> > PS: Sorry about my English...I hope u can understand. >> >> I think you might be looking for EXTEND. It's in the SQL Syntax manual >> at >> http://www-306.ibm.com/software/data/informix/pubs/library/ >> >> -- >> Bye now, >> Obnoxio >> >> "C'est pas parce qu'on n'a rien ' dire qu'il faut fermer sa gueule" >> - Coluche >> >> did i mention i like nulls? heck, i even go so far as to say that all >> columns in a table except the primary key could/should be nullable. this >> has certain advantages, for example, if you need to insert a child >> record >> and you don't have a parent row for it, just do an insert into the >> parent >> table with the primary key value (everything else null), and voila, >> relational integrity is preserved. but this is, admittedly, a bit >> controversial among modellers. >> >> --r937, dbforums.com >> > -- Bye now, Obnoxio "C'est pas parce qu'on n'a rien ' dire qu'il faut fermer sa gueule" - Coluche did i mention i like nulls? heck, i even go so far as to say that all columns in a table except the primary key could/should be nullable. this has certain advantages, for example, if you need to insert a child record and you don't have a parent row for it, just do an insert into the parent table with the primary key value (everything else null), and voila, relational integrity is preserved. but this is, admittedly, a bit controversial among modellers. --r937, dbforums.com