create table test(no number(4),name varchar2(15));
Table created.
SQL> desc test
Name Null? Type
----------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------
NO NUMBER(4)
NAME VARCHAR2(15)
SQL> insert into test values(nvl((select max(no) from test),100)+1,'&name');
Enter value for name: qwe
old 1: insert into test values(nvl((select max(no) from test),100)+1,'&name')
new 1: insert into test values(nvl((select max(no) from test),100)+1,'qwe')
1 row created.
SQL> /
Enter value for name: asd
old 1: insert into test values(nvl((select max(no) from test),100)+1,'&name')
new 1: insert into test values(nvl((select max(no) from test),100)+1,'asd')
1 row created.
SQL> /
Enter value for name: asdwe
old 1: insert into test values(nvl((select max(no) from test),100)+1,'&name')
new 1: insert into test values(nvl((select max(no) from test),100)+1,'asdwe')
1 row created.
SQL> /
Enter value for name: wewe
old 1: insert into test values(nvl((select max(no) from test),100)+1,'&name')
new 1: insert into test values(nvl((select max(no) from test),100)+1,'wewe')
1 row created.
SQL> select * from test;
NO NAME
---------- ---------------
101 qwe
102 asd
103 asdwe
104 wewe
No comments:
Post a Comment