Sunteți pe pagina 1din 5

SQL> rollback r1; rollback r1 * ERROR at line 1: ORA-02181: invalid option to ROLLBACK WORK SQL> SQL> create table

func(roll number(10),name varchar2(10),mark number(10)); Table created. SQL> insert into function values(&id,'&name','&mark') 2 insert into function values(&id,'&name','&mark'); Enter value for id: 1 Enter value for name: aaa Enter value for mark: 90 old 1: insert into function values(&id,'&name','&mark') new 1: insert into function values(1,'aaa','90') Enter value for id: 2 Enter value for name: bbb Enter value for mark: 99 old 2: insert into function values(&id,'&name','&mark') new 2: insert into function values(2,'bbb','99') insert into function values(2,'bbb','99') * ERROR at line 2: ORA-00933: SQL command not properly ended SQL> insert into function values(&id,'&name','&mark'); Enter value for id: 1 Enter value for name: sara Enter value for mark: 99 old 1: insert into function values(&id,'&name','&mark') new 1: insert into function values(1,'sara','99') insert into function values(1,'sara','99') * ERROR at line 1: ORA-00942: table or view does not exist SQL> insert into function values(&id,'&name','&mark'); Enter value for id: 1 Enter value for name: ddd Enter value for mark: 89 old 1: insert into function values(&id,'&name','&mark') new 1: insert into function values(1,'ddd','89') insert into function values(1,'ddd','89') * ERROR at line 1: ORA-00942: table or view does not exist SQL> insert into function values(&id,'&name','&mark'); Enter value for id: 1 Enter value for name: aaa Enter value for mark: 87 old 1: insert into function values(&id,'&name','&mark') new 1: insert into function values(1,'aaa','87')

insert into function values(1,'aaa','87') * ERROR at line 1: ORA-00942: table or view does not exist SQL> insert into func values(&id,'&name','&mark'); Enter value for id: 1 Enter value for name: aaa Enter value for mark: 87 old 1: insert into func values(&id,'&name','&mark') new 1: insert into func values(1,'aaa','87') 1 row created. SQL> insert into func values(&id,'&name','&mark'); Enter value for id: 2 Enter value for name: bbb Enter value for mark: 99 old 1: insert into func values(&id,'&name','&mark') new 1: insert into func values(2,'bbb','99') 1 row created. SQL> insert into func values(&id,'&name','&mark'); Enter value for id: 3 Enter value for name: ccc Enter value for mark: 98 old 1: insert into func values(&id,'&name','&mark') new 1: insert into func values(3,'ccc','98') 1 row created. SQL> insert into func values(&id,'&name','&mark'); Enter value for id: 4 Enter value for name: ddd Enter value for mark: 97 old 1: insert into func values(&id,'&name','&mark') new 1: insert into func values(4,'ddd','97') 1 row created. SQL> insert into func values(&id,'&name','&mark'); Enter value for id: 5 Enter value for name: eee Enter value for mark: 99 old 1: insert into func values(&id,'&name','&mark') new 1: insert into func values(5,'eee','99') 1 row created. SQL> select*from func; ROLL ---------1 2 3 4 5 NAME MARK ---------- ---------aaa 87 bbb 99 ccc 98 ddd 97 eee 99

SQL> select upper(name) from func; UPPER(NAME ---------AAA BBB CCC DDD EEE SQL> select lower(name) from func; LOWER(NAME ---------aaa bbb ccc ddd eee SQL> select initcap(name 2 SQL> SQL> SQL> SQL> select initcap(name) from func; INITCAP(NA ---------Aaa Bbb Ccc Ddd Eee SQL> select substr('welcome',1,4)from dual; SUBS ---welc SQL> select substr('welcome','come')from dual; select substr('welcome','come')from dual * ERROR at line 1: ORA-01722: invalid number SQL> select itrim('welcome','come')from dual; select itrim('welcome','come')from dual * ERROR at line 1: ORA-00904: "ITRIM": invalid identifier SQL> select trim('welcome','come')from dual; select trim('welcome','come')from dual * ERROR at line 1:

ORA-00907: missing right parenthesis SQL> select lpad('hello',10,'#')from dual; LPAD('HELL ---------#####hello SQL> select ltrim('welcome','come')from dual; LTRIM(' ------welcome SQL> select rtrim('welcome','come')from dual; RTR --wel SQL> select rpad('hello',10,'#')from dual; RPAD('HELL ---------hello##### SQL> select replace('jack jil','b')from dual; REPLACE( -------jack jil SQL> select translate('back jil','b')from dual; select translate('back jil','b')from dual * ERROR at line 1: ORA-00909: invalid number of arguments SQL> select translate('back bil boy','b','j')from dual; TRANSLATE('B -----------jack jil joy SQL> select*from func where namelike'b%'; select*from func where namelike'b%' * ERROR at line 1: ORA-00920: invalid relational operator SQL> select*from func where name like 'b%'; ROLL NAME MARK ---------- ---------- ---------2 bbb 99 SQL> select avg(mark) from func;

AVG(MARK) ---------96 SQL> select min(mark)from func; MIN(MARK) ---------87 SQL> select max(mark)from func; MAX(MARK) ---------99 SQL> select count(mark)from func; COUNT(MARK) ----------5 SQL> select sum(mark)from func; SUM(MARK) ---------480 SQL> select variance(mark)from func; VARIANCE(MARK) -------------26 SQL> select stddev(mark)from func; STDDEV(MARK) -----------5.09901951 SQL> select abs(-5) from dual; ABS(-5) ---------5 SQL> select power(3,3) from dual; POWER(3,3) ---------27 SQL> select trunc(901.9956) from dual; TRUNC(901.9956) --------------901 SQL> select trunc() from dual;

S-ar putea să vă placă și