Rafael I prefer slash asterisk comments e.g. select * /*ash.event*/ from gv$active_session_history ash to select *--ash.event_id FROM gv$active_session_history ash
Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Tue, 20 Jan 2009 13:36:26 +0000 > From: c...@cam.ac.uk > To: visser.raf...@gmail.com > CC: dbi-users@perl.org > Subject: Re: ORA-00923 > > 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 _________________________________________________________________ It’s the same Hotmail®. If by “same” you mean up to 70% faster. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Same_022009