Re: Help on SQL
Date: 4 May 1998 10:57:00 -0700
Message-ID: <6ikvhc$4i_at_nntp02.primenet.com>
This is answer for part1
SQL> select * from test1;
SITNO NAME CATEGORY --------- ---------------------------------------- -------------- 500 Mahesh UNIX
SQL> insert into test1
2 select max(sitno)+1, 'Menon', 'DOS' from test1;
1 row created.
SQL> select * from test1;
SITNO NAME CATEGORY --------- ---------------------------------------- -------------- 500 Mahesh UNIX 501 Menon DOS
This is for part2
SQL> alter table test1 add mylong long;
Table altered.
SQL> desc test1;
Name Null? Type ------------------------------- -------- ---- SITNO NUMBER NAME VARCHAR2(40) CATEGORY VARCHAR2(30) MYLONG LONG
SQL> insert into test1(sitno, name, category) values 2 (502, 'NEW', 'SQL'); 1 row created.
Ofcourse, I was assuming you are not trying to put values into the LONG field. Then you may have to define cursor and use PL/SQL.
HTH Prasad Chavali
Mahesh Menon wrote in message <6ikpns$q8e_at_bcarh8ab.bnr.ca>...
>
>hi,
> a couple of SQL related queries from an SQL 'moron'.
>
> ONE
> ---
> consider the following table which contains
> the following tuple:
>
> SITNO NAME CATEGORY
> ---------------------------------------
> 500 Mahesh UNIX
>
> i'd like to add another tuple with name = 'MENON'
> and category = 'DOS'. the sitno field should be
> generated automatically and should be MAX(SITNO) + 1.
>
> can this be done using a single SQL statement
> with or without the use of temporary tables.
>
>
> TWO
> ---
> how do i insert tuples into a table containing a
> 'long' field using SQL*PLUS.
>
>
>mahesh "clueless" menon
Received on Mon May 04 1998 - 19:57:00 CEST