Oracle SQL statement not working -
can please tell me wrong sql , why not executing!
drop table car5849; create table car5849 ( idno varchar(20) primary key , make varchar(20) , miles number(6) , dateofpurchase date ); insert car5849 (idno, make, miles, dateofpurchase) values (pgj058,'red mustang', 27070, to_date(‘11/07/2011’, ‘dd/mm/yyyy’); insert car5849 (idno, make, miles, dateofpurchase) values (pgj058,'yellow mustang', 35725, to_date(‘24/09/2015’, ‘dd/mm/yyyy’); insert car5849 (idno, make, miles, dateofpurchase) values (pgj058,'black mustang', 14589, to_date(‘11/02/2010’, ‘dd/mm/yyyy’);
you missing single quotes around first argument. recommend 3 other changes:
- varchar2 instead of varchar
date
instead ofto_date()
- remove primary key
idno
, because appear want set column same value in multiple rows.
so:
drop table car5849; create table car5849 ( idno varchar2(20), make varchar2(20), miles number(6), dateofpurchase date ); insert car5849 (idno, make, miles, dateofpurchase) values ('pgj058', 'red mustang', 27070, date '2011-07-11'); insert car5849 (idno, make, miles, dateofpurchase) values ('pgj058', 'yellow mustang', 35725, date '2015-09-24'); insert car5849 (idno, make, miles, dateofpurchase) values ('pgj058', 'black mustang', 14589, date '2010-02-11');
Comments
Post a Comment