What is ROWNUM? If there is support for it, might want to make sure that
it's supported by your db version. I know some oracle versions support it,
but not sure.
Best way to test is to run in sql plus first.
Ilya
-----Original Message-----
From: He Hong
To: [EMAIL PROTECTED]
Sent: 3/12/02 1:20 PM
Subject: what's wrong with my code? Thanks
Hi, there,
Here is my code. When I ran it, something is not right.
my $qstr = qq
#SELECT subject,group_group,submitter,TO_CHAR(close_time, 'MM/DD/YY
HH24:MI'),description,comments,eta,noc,status,notification_id,master
FROM notification
WHERE status = 'Active' and group_group = ?
UNION
select subject,group_group,submitter,TO_CHAR(close_time, 'MM/DD/YY
HH24:MI'),description,comments,eta,noc,status,notification_id,master
FROM notification
WHERE group_group = ?
and ROWNUM <= 500
ORDER BY close_time DESC#;
$list = $dbh->prepare($qstr) or die "Couldn't prepare statement: "
..
$DBI->errstr();
$list->execute($group) or die "Couldn't execute statement: " .
$DBI->errstr();
I want the "rownum <=500 order by close_time desc" to act as the
condition
of the second select statement, which means to be execute before the
union.
The erroer message I got is "DBD::Oracle::db prepare failed: ORA-00904:
invalid column name (DBD ERROR: OCIStmtExecute/Describe)". I checked
several times and couldn't find anything wrong with the column name.
When I took the "rownum <=500 order by close_time desc" off, it works
ok. But when I added it, it went wrong.
Could somebody give me a hint about what may cause the problem? I am
really appreciate it.
He