Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How To Insert DATE
jokesmalaysia wrote:
>
>
> hello
>
> I have a very tiny, tiny problem
> I want to create a table with following attributes:
>
> create table Employee
> (emp_id number(4)
> name varchar(15)
> age number(3)
> date_hired date? <-- not sure about this command!!
> address varchar (30));
>
> I want to insert this values(example only)
>
> insert into emplyoee
> values ('0001', 'John', '23', '18-JAN-2001', 'Chicago');
>
> can someone teach me how to
> 1) set emp_id as a primary key.
> 2) insert date such as 18-JAN-2001.
> 3) save all data into a floppy.
>
> do you have any suggestion on books, newsletters, web, magazine etc,
> etc?
>
> please help me out here.
>
> i'm a newbie to SQL.
>
> thanx in advance.
>
>
> Sent via Deja.com
> http://www.deja.com/
Hi there!!!! First of all part of your table structure is 75% right....=) Try this: CREATE TABLE EMPLOYEE
(EMP_ID NUMBER(4), NAME VARCHAR2(30), AGE NUMBER(3), DATE_HIRED DATE, ADDRESS VARCHAR2(40)); Here's the INSERT statement: INSERT INTO EMPLOYEE VALUES (0001,'JOHN',23,'18-JAN-2001','CHICAGO');Single quote are to be use with character strings only(such as VARCHAR2,and DATE, not with number)....
Hope this help you out alittle...=)
Oh to save the date..... type SPOOL at the SQl prompt Example: SPOOL data <----- (that's a name..give it any name u want.
select * from emp1 ; SPOOL off then type EDIT data.LST
-- Posted via CNET Help.com http://www.help.com/Received on Sat Feb 03 2001 - 09:30:06 CST