If you're on Oracle, you can do:
SELECT nvl(max(some_item),0)
FROM db
WHERE item = 'something'
That will give you 0 if there are no "something" and will give you the
value.
Paul Rensel wrote:
>Hi there,
>
>I want to use a "select max(some_item) from db where item = 'something"
>query.
>
>How c
you could count the number of records in your table first.
Then if count is greater than 0 you can do your max selection. I assume you are
trying to find the max value stored in a field. Such as, the largest row_id.
Paul Rensel wrote:
>
> Hi there,
>
> I want to use a "select max(some_item)
Hi there,
I want to use a "select max(some_item) from db where item = 'something"
query.
How can i check or test if there is indeed a max(some_item) for a given
'something' selection given and when there's not an max(some_item) ??
I've tried everything like $sth->rows and such but it seems that
sub valida_user
{
use DBI;
use DBD::Oracle qw(ORA_VARCHAR2);
my($db, $sth);
$ENV{ORACLE_HOME} = "/u1/oracle/product/8.0.5";
$db = DBI->connect("dbi:Oracle:host=my_ip;sid=fty", "hmo", "hmo")
or die "Unable to connect: $DBI::errstr";
$db->{RaiseError} = 1;
my $user=$_[0];
my
Para: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Asunto: Re: problem with select
>
> It looks like your SQL*Plus session has a ALTER SESSION SET
> NLS_DATE_FORMAT
> = 'DD/MM/YY HH:MI:SS AP'; somewhere. (I'm not sure about the AP).
> Personally, I prefer '-M
$temp;
}
***
It doesn´t work the variable returned is ""
Saludos,
Hernán Moreno
> -Mensaje original-
> De: Laurie Gennari [SMTP:[EMAIL PROTECTED]]
> Enviado el
ED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 22, 2001 18:06
Subject: problem with select
select IDEN,HORA_SUBG_HORA from sm_subgrupos_horas_dat;
this is the result of de query from the data base (oracle)
IDENHORA_SUBG_HORA
131 7/10/01 11:08:00 AM
136 1/01/01 1:00:00 AM
But ,if I
You could do your select with a to_char(, 'MM/DD/YY HH:MI:SS').
ltg
--
select IDEN,HORA_SUBG_HORA from sm_subgrupos_horas_dat;
this is the result of de query from the data base (oracle)
IDENHORA_SUBG_HORA
131 7/10/01 11:08:00 AM
136 1/01/01 1:00:00 AM
But ,if I do it on DBI,DBD with the same query this is showed:
IDENHORA_SUBG_HORA
131 7-OCT