Means that your query has a column name that is either wrong or misspelled. Check the query. Ilya Sterin -----Original Message----- From: Xiaoxia Dong To: [EMAIL PROTECTED] Sent: 3/15/01 7:53 AM Subject: [Fwd: [Fwd: how to check to a database to see if i need update or insert]] Xiaoxia Dong wrote: > Xiaoxia Dong wrote: > > > Dear All: > > > > I am new to perl DBI. I am trying to do something that like machine > > uptime, i read all those in from a set of > > file. Everytime, if i found machine done, i need to insert a new record, > > otherwise, i just need to update > > the existing record in the oracle database. How can i do it? > > > > Suppose i know i just need to update, i have the following sql > > statement: > > > > $sql = "UPDATE uptime SET up_time=$uphours > > WHERE hostname = $host and > > startdate between > > (TO_DATE('$yy:$month:$sday:$shour:$sminute:00', > > 'YYYY:MM:DD:HH24:MI:SS') and > > TO_DATE('$yy:$month:$sday:$shour:$sminute:59', > > 'YYYY:MM:DD:HH24:MI:SS') > > )"; > > > > when i try to execute this statement, it gave following messages: > > DBD::Oracle::st execute failed: ORA-00904: invalid column name (DBD > > ERROR: OCIStmtExecute) at upora.pl line 135. > > UPDATE uptime SET up_time=212.633333333333 > > WHERE hostname = twister and > > startdate between > > TO_DATE('2001:3:8:5:34:00', > > 'YYYY:MM:DD:HH24:MI:SS') and > > TO_DATE('2001:3:8:5:34:59', > > 'YYYY:MM:DD:HH24:MI:SS') > > > > ORA-00904: invalid column name (DBD ERROR: OCIStmtExecute)after get into > > uptimeOracle > > how can i correct this one? > > > > Thanks very much for any help. > > > > xiaoxia dong