Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sql database problem
In article <6PbB4.2398$5b5.85410_at_news2-win.server.ntlworld.com>,
"Mark Thomas" <mark.thomas5_at_dtn.ntl> wrote:
> can anybody help with this problem
>
> using a single insert into .... Select....command, create a hiring
> transaction for Mr f Curlew for the XJ6 4000 for October 10th
> 1997 at 10:00. do this without visually inspecting the tables to find
out
> the relevant registration number and account number
> - get sql itself to look up the tables.
>
> why does the below not work?
>
> insert into hiring (regno, time_out,cust_acc)
> values ((select regno from car where model = 'XJ6' and esize = 4000),
> to_date ('10-OCT-97' 10:00:00,
> 'DD-MM-YY' H24:MI:SS'),
> (select acc_no from customer where name = 'Mr F Curlew');
>
Correct syntax (I assume it's Oracle database): insert into hiring (regno, time_out,cust_acc) select c.regno, to_date('10-OCT-97 10:00:00', 'DD-MON-YY HH24:MI:SS'),
a.acc_no
from car c, customer a
where c.model = 'XJ6' and c.esize = 4000 and a.name = 'Mr F Curlew'
There are also strange quotes inside of date constant and format mask and the format mask is inconsistent with date constant (should be MON, not MM for OCT.
Alex Filonov
> error message reads : missing expression @ values ((select
>
> thanx in advance
>
> mark
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Mar 19 2000 - 17:02:54 CST
![]() |
![]() |