On 20/01/09 13:07, Rafael Visser wrote:
Hi.

The following sql runs ok by sqlplus on the server.

===================================================================================
SQL> !more wait_class_ii.sql
with aux as  ( select *--ash.event_id
FROM gv$active_session_history ash
where ash.sample_time > SYSDATE - 1/1440)
select evt.wait_class, count(ash.event_id)
FROM aux ash, gv$event_name evt
where
evt.wait_class in ('User I/O','Network','System
I/O','Commit','Other','Application',
'Configuration','Concurrency','Cluster','Administrative')
AND ash.event_id(+) = evt.event_id
GROUP BY evt.wait_class;

'--' in SQL introduces a comment delimited by end-of-line, so,
in the above the comment consists of just '--ash.event_id'

$sth=$dbh->prepare("with aux as (SELECT *--ash.event_id FROM
gv\$active_session_history ash  where ash.sample_time > SYSDATE -
1/1440)
         SELECT evt.wait_class, count(ash.event_id) FROM aux ash,
gv\$event_name evt
          where evt.wait_class in ('User I/O','Network','System
I/O','Commit','Other','Application',
           'Configuration','Concurrency','Cluster','Administrative')
            AND ash.event_id(+) = evt.event_id
            GROUP BY evt.wait_class
             ORDER BY count(ash.event_id) DESC ");

In the perl there is a space rather than a newline between
'--ash.event_id' and 'FROM'. Thus the comment has swallowed the 'FROM'.

--
Charles Jardine - Computing Service, University of Cambridge
c...@cam.ac.uk    Tel: +44 1223 334506, Fax: +44 1223 334679

Reply via email to