Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Another newbie question!
"MadG" <patrick4133_at_hotmail.com> wrote in message
news:4E0c6.242897$59.61091331_at_news3.rdc1.on.home.com...
> Hello again,
>
> How do I insert a selected amount of entries into a table?
>
>
> insert into portfolio values ('P001','M2',25000); gets me all
> three, but what if I want to only insert the first and last record?
>
> Thanks :)
>
> Pat
>
>
Sorry to say so, but don't you mix up records and columns?
Your current statement inserts 1 record with 3 columns.
If you want to leave out anyone of those columns, the column must be null
allowed in your table definition, and you must explicitly specify them in
your insert statement like this
insert into portfolio
(col1
,col3)
values
('P001'
,25000)
As you will notice I deliberatly left out the middle column. If that column is defined as 'not null' the statement above will result in ora-1400 mandatory column is null during insert. This is pretty basic stuff, and you will proceed faster by reading manuals and tutorials, and/or Oracle8i The complete reference compared to relying on this newsgroup completely.
Hth,
Sybrand Bakker, Oracle DBA Received on Thu Jan 25 2001 - 15:38:06 CST