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

Reply via email to