Вы находитесь на странице: 1из 29

ORACLE DATABASE: IT IS COLLECTION OF DATA ,ANY ORGANISATION CONTAINS ITS OWN DAT.ABASE MANAGING .

DATABASE IS CALLED AS DATABASE MANAGEMENT SYSTEM (DBMS). MANAGING DATABASE MEANS CREATING NEW RECORDS,UPDATING AND DELETING RECORDS. RDBMS :RELATIONAL DATABASE MANAGEMENT SYSTEM GENERALLY IN DATABASE DATAMAINTAINED AS IN THE FORM OF TABLES (RELATION) A TABLE IS COLLECTION OF RECORDS AND FILES. DATABASE MAINTAINED AS CLIENT /SERVER. SERVER IS A COMPUTER IN WHICH THE WHOLE DATA IS STORED. IN OLDENDAYS, DATABASE WAS MAINTAINED IN THE FORM OF FILES. I.E : FILE ORGANISATION SYSTEM IN THIS SYSTEM SOME DATA MAINTAINED BY A NUMBER OF PERSONS. IT CAUSES : REFUNDENCY INCONSISTENCY BACK UP ACCESSING DATA ETC THE DRAWBACKS OF FILE MANAGEMENT SYSTEM ARE OVERCOME IN DBMS BY CLIENT /SERVER MAINTAINCE. DBA : DATABASE ADMINSTRATION HE IS THE PERSON WHO CREATE DATA BASE AND MANAGE IT. END USER : THE USER WHO ARE USING THE DATABASE. COLUMN /ATTRIBUTE EMP TABLE NAME EMPNO ENAME SAL 101 A 10500 105 B 4600 161 C 5200 110 D 2500 ROW/FIELD

JOB MANAGER CLERK TYPIST OFFICE BOY

EMPLOYEE ENTITY EMP,DEPT,SAL ENTITY COLUMN/FIELD/ATTRIBUTEEMPNO,ENAME,JOB,SAL IN ORACLE DATABASE WAS SQUARED BY GIVING PASSWORDDO EVERY USER. UNIVERSAL USERNAME :SCOTT PASSWORD :TIGER THE WORK AREA ARE ENVIRONMENT OF SQLIS KNOWN AS SQL *PLUS HOW TO OPEN : CLICK ON START BUTTON PROGRAMS ORACLE for windows ntSQLPLUSenter.. ENTER USERNAME,PASSWORD AND CLICK ON OK. HOSTSTRING IS ONLY FOR CLIENT /SERVERMODE IT SPECIFIES THE DATABASE NAME,WHICH WAS STORED IN SERVER. THE SQL COMMAND ARE DIVIDED INTO FOUR TYPES 1)DDL DATA DEFINITION LANGUAGE 2)DML DATA MANIPULATION LANGUAGE 3) DCL DATA CONTROL LANGAUGE 4)TCL TRANSACTION CONTROL LANGUAGE SQL

DDL CREATE ALTER

DML INSERT UPDATE

DCL GRANT REVOKE

TCL COMMIT ROLLBACK

TRUNCATE DELETE DROP SELECT

24-9-09 Datatypes in SQL : 1)Number 38 digits 2)Number(n) -999 to 999 3)Number (n,d) n- max length d- number of digits in decimal number(5,3)23.378 CHAR-> a)char b)varchar /varchar2 c)long char fixed length ex: ename char(10) sai 10size hello 10size varchar fixedlength min1 max 2000 varcharvariablelength ename varchar2(20) sai -3 hello -5 long -2gb longrow -2gb note : long is rearly used datatype and it must be give to able of onlyone column. Long row is used to store photos,videos etc. Date : it is used to take date data must in the form of dd-mm-yyyy ex:24-apr-2009 note : 1)in sql,comments,table names,column names are not case sensitive, but data in the column is case sensitive. 2)when we entering date and character data then it must be in singlequote marks.

Create :it is used to create a table description. Syn:

Create table <tablename> (col1 datatype,col2 datatype,col3 datatype); Ex: Create table stud(sno number(2),sname varchar2(20),age number(2), marks number(4,2)); Describe :it is used to show the table structure or table description. syn: desc <tablename> ex: desc stud to close sql* plus sql> quit or exit To clear the screen Sql>cl scr Run Sqlplus .. commandline Sqlplusw. Window mode Altered: Ex: Sql> alter table stud add (fname varchar2(20)); Table altered 2)to remove an existing column Syn : alter table <tablename> drop column <colname> Ex: alter table stud drop column fname; 3)to modify datatype of a column: Syn: Alter table <tablename> modify oldcolumn datatype; Ex: alter table stud modify (course varchar2(20)); note : while modifying a column ,you cant decrease the dimension ,when the table contain the records

Truncate : It is used to remove all records but table structure left in database. Syn: truncate table <tablename>; Ex: truncate table stud; Drop : It is used to remove all the records with structures also removes. Syn :drop table <table name>; Ex: sql> drop table stud; Table dropped

12-10-2009 DML :DATA MANIPULATION LANGUAGE Insert : it is used to create a new record with given values. Syn : Insert into <tablename> values(values for the columns); Ex: Sql>insert into stud values(1,abc,32,7032); 1 row created to create a new record with specified column values Syn : insert into <tablename>(column names) values (values for the columns); Ex: insert into stud (age,sid,mks) values(24,3,34);

Select : it is used to display or show the records in the table. Syn: select * /col_name from <tablenm> [where condition]; Ex: sql> select * from stud; Sql> select sid,age from stud;

Sql> Create table item(itno number(3),itname varchar2(20),price number(5,3),mfd Date); Sql> alter table item add (stock number(3)); Sql> insert into item values(107,sugar,67.89,12-jan-2009,560); Sql> insert into item values(108,rice,58.76,22-mar-2008,358); Sql> insert into item values(109,soap,87.69,13-aug-2007,487); Sql> insert into item (no,price,stock) values(110,99.89,517); Sql> select * from item; Itemno 107 108 109 110 Itemname Sugar Rice Soap Price 67.89 58.763 87.674 99.873 Mfd 12-jan-2009 22-mar-2008 13-aug-2007 Stock 459 358 487 517

To display all the table details in a particular user: Syn : select * from tab; Ex: select * from item;

Update: It is used to modify on existing data in a table. Syn: update <tablename> set column_value[where condition]; If we want commit the where condition if effect to all the records of table otherwise the condition satisfied records only update. Ex: update item set mfd=12-oct-2004 where itemno=110;

Delete : it is used to remove the records from a table; Syn : delete from <tablename> [where condition]; Sql> delete from item where itemno=110; TCL commands: DDL commands (create,alter,truncate,drop) are autocommit statements but DML commands (insert,delete,update) are not an autocommit statements. To saves or unsave the DML commands on database we use TCL commands. Commit is used to save the DML commands on table. Sql> commit; Rollback :it is used to unsave or undo DML commands on table; Sql> rollback;

Operators: Arithmetic: +, -, *, / Conditional : < , >, <=, >=, = Logical:And or Not Special operators : Between and ,like ,in, is & replacement operator : insert into item values (&itemno,&itname,&price,&date);

enter value for itemno: 5 enter value for itemname: soap enter value for price :45 enter value for date : 10-apr-2009 old: insert into item values (&itemno,&itemname,&price,&date); new: insert into item values(5,soap,45,10-apr-2009); / .. it execute previous query note :set numwidth 5

Eno Ename Job Sal Deptno 1 MARTIN manager 4500 10 2 ajay clerk 3000 20 3 sunil clerk 3000 20 4 abc salesman 2000 30 Create table saiemp(eno number(3),ename varchar2(15),job varchar2(15),sal number(5,2),deptno number(3)); Insert into saiemp values(&eno,&ename,&job,&sal,&deptno);

1)Display the emp details who are getting sal<1500? a) select * from emp where sal<=1500; 2)Display eno ,ename,job, deptno from emp? a)select eno,ename,job,deptno from emp where deptno=30; 3)Display the emp details of martin? a) select * from emp where ename=martin; 4) Display emp details who are working as manager? a) select * from emp where job=manager;

case sensitive data as displayed . 5) Display the emp details who are working in either deptno 10 or 20? a) select * from emp where deptno=10 or deptno=20; 6)Display the emp details whose job=clerk and salesman? a)select * from emp where job=clerk or job=salesman; 7)Display the emp details who are working not in deptno=20? a)select * from emp where deptno< >20;

RETURN MULTIPLEVALUES USING SUBQUERIES: IN : It is used to check a list of items and display records are statisfied any of the values in set. Ex: Sql: select * from emp where job in(salesman,clerk,manager); BETWEEN AND: It is used to check the range values. Ex: Sql> select * from emp where sal between 1000 and 2000; It displays emp details who are getting salary in between 1000 and 2000. LIKE: It is used to compare characters. % no.of chars - single char. Ex: sql> select * from emp where ename like a%; it displays the employee details where names starts with A . ex: sql> select * from emp where ename like __A%; it displays the emp details whose name contains third character as A.

ex: sql> select * from emp where ename like%n; IS : it is used to compare the null values. Ex: Sql > select * from emp where sal is null; It displays the employees who are not getting any sal. Ex: select * from emp where sal is not null; Functions : oracle supports a rich set of functions.these are two types: 1)single row function : those functions produces result value only. Numeric fun. Character fun. Date fun. Conversion fun. Misc fun. 2) multirow function : those functions are produces result in one row or more than one value. Groupng functions Numeric functions : sqrt(num);

Dual :- it is system table it contains one row and one column, it is used to show the output of functions. Dual: DUMMY varchar2(1);

Numeric functions : Sqrt(num) : Power(x,y) : xy Mod(x,y) :remainders where y divide x(x/y) Sign(n) : n>0 +1 N=00 N<0 -1 Sin(no) ,Cos(no),tan(no)

Abs(num) :absolute num Ascii (char) Chr(num) Ceil(7.689) nearly next integer. Floor(7.234) near previous integer Round(num,p)(7.6543,2) 7.65 Character functions : Length(num) Upper(name) Lower(name) Trim(name) Rtrim(name) Ltrim(name) Substr(name,no) Substr(name,starno,no of) Select * from where substr(ename,1)=a; Date functions: 1)sysdate: it gives the system date. 2) add-months(date,no) 3)months-between(date1,date2) 4)last-day(date) last day in the given month select months-between(sysdate,23-aug-2009) from dual;

special functions :user : it gives the user name who was logged. Uid: it gives user id,it was unique Nul(col,0) it assign a value to null data in column. Select ename,sal,comm,sal+nul(comm,0) from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ------ ---------- --------- --------- --------- --------- --------- --------7369 SMITH CLERK 7902 17-DEC-80 800 20

7499 ALLEN 300 30 7521 WARD 500 30 7566 JONES 20 7654 MARTIN 1400 30 7698 BLAKE 30 7782 CLARK 10 7788 SCOTT 20 7839 KING 10 7844 TURNER 0 30 7876 ADAMS 20 7900 JAMES 30 7902 FORD 20 7934 MILLER 10 28-10-2009

SALESMAN SALESMAN MANAGER SALESMAN MANAGER MANAGER ANALYST PRESIDENT SALESMAN CLERK CLERK ANALYST CLERK

7698 7698 7839 7698 7839 7839 7566

20-FEB-81 22-FEB-81 02-APR-81 2975

1600 1250

28-SEP-81 01-MAY-81 09-JUN-81 19-APR-87 17-NOV-81 5000

1250 2850 2450 3000

7698 7788 7698 7566 7782

08-SEP-81 23-MAY-87 03-DEC-81 1100 950

1500

03-DEC-81 23-JAN-82 1300

3000

convertion functions: to char(date,format) it converts date into characters.

To-date(charset ,format) Character set converts into date format. Different format: 1)dd date(1-31) 2)Mon . Jan,feb,mar. 3)month. January,april 4)yy .. year in two digits. 5)day weekday 6)hh . Hour 7)mm. Minutes 8)ss .. seconds 9)hh24 : 24 hours 1)select to_char(sysdate,'hh24:mm:ss') from dual; a) TO_CHAR( -------16:10:59

2) select to_char(to_date('12-apr-09','dd-mon-yy'),'month') from dual; a) TO_CHAR(T --------april 3) select job,count(*) from emp group by job; a) JOB COUNT(*) --------- --------ANALYST 2 CLERK 4 MANAGER 3 PRESIDENT 1 SALESMAN 4 Multirow function(grouping functions) Avg,min,max,sum,count These functions are perform on numbers of rows and returns one or more than Group by clauses

It is used to form a group of data in the column . Syn: Select groupfun from <tablenm> group by column; a) select job,min(sal),max(sal) from emp group by job; JOB MIN(SAL) MAX(SAL) --------- --------- --------ANALYST 3000 3000 CLERK 800 1300 MANAGER 2450 2975 PRESIDENT 5000 5000 SALESMAN 1250 1600 Note:1) grouping functions are not allowed in where condition. 2) we can not display data of other columns which was not in group by clause. 3) conditions will not allowed in group by clause with where stmt . Having statements: By using this we can apply condition in group by clauses . Syn: Select column,groupfun from<tablenm> group by column having condition; A) select job,min(sal),max(sal) from emp group by job having job='SALESMAN'; JOB MIN(SAL) MAX(SAL) --------- --------- --------SALESMAN 1250 1600 SELECT DEPTNO,MAX(SAL) FROM EMP GROUP BY DEPTNO HAVING DEPTNO=30; DEPTNO MAX(SAL) ------- --------30 2850 1)DISPLAY THE EMP DETAILS WHO ARE JOIN IN THE YEAR OF 81

A) select * from emp where to-char(hiredate,'yy') 2)display the total sal of deptno=20; a) select deptno,sum(sal) from emp group by deptno having deptno=20 DEPTNO SUM(SAL) --------- --------20 10875 3)display the avg salary of manager. a) select job,avg(sal) from emp group by job having job='MANAGER' JOB AVG(SAL) --------- --------MANAGER 2758.3333

Order by:It is used to display the data of a table in either ascending or descending order depending upon data in a column. Syn: Select * from <tablenm> order by <column> [desc]; By default it gives in ascending order. If we specify desc at end it gives descending order Ex: select * from emp order by ename select * from emp order by sal desc; 30-10-2009 Constraints It is nothing but restruction are applied to columns of table these constraints are fired at the time of user entered wrong data. Constraints are different types: 1)unique 2)not null 3)primary key

4)foreign key 5)check Unique: The column with unique constraint is cannot accept repeated value but it take null values. Syn: create table <tablenm> (col datatype unique,col2 datatype,); Ex: Create table stud(sid number unique,sname varchar2(20),age number); Now sid cannot take repeated values if omits sid value gives an error. If table was already created : Syn: alter table <tablenm> add constraint <cons_nm> unique(colnm); Ex: Alter table book add constraint book_uniq unique(b id); To remove unique conatraint: Syn: Alter table <tablenm> drop constraint <const nm>; Ex: Alter table stud drop constraint stud_uniq; Not null: The column with not null would not take null values but it accept repeated values. Syn: create table <tablenm> (col,datatype not null,col2 datatype,); Ex: create table s(sno number(3) not null,sname varchar2(20)); syn: alter table <tablenm>modify oldcolnm datatype not null; to remove not null constraint. Syn: alter table <tablenm> modify old colnm datatype null;

3)Primary key: Is is the combination of unique and not null. The column with primary key constraint will not accept null and repeated values. In a table ,only one column can apply primary key constraint. Syn: Create table <tablenm> (col1 datatype primary key,col2 datatype,); Ex: create table stud1(sid number primary key,sname varchar2(20) not null,course varchar2(20) not null, Fee number(5)); Foreign key: The column with foreign key must be either primary key or unique in another table. Then a relation will be form in both tables. Parent child Master.details Ex: Emp .details Eno (*),ename,sal,deptno Dept master Deptno(*),dname ,loc Ex: create table dept1(deptno number primary key,dname varchar2(20), loc varchar2(20)); Ex: create table emp1(eno number primary key,sal number,deptno number references dept1(deptno)); Ex: create table lib(bid number primary key,bnm varchar2(20),sid number references stud1(sid));

Note: 1)a parent record cannot be deleted if it contains child record. 2)A child record can not be added with out parent record. Check: It is used to check the value entered in the column. Ex: create table sai(sid number,snm varchar2(20),mks number check(mks<=100)); Sub Queries: A querie with in another querie is calles as subquery. (or) nested query The output of inner query is input for outer query. Find deptname of smith? 1)select deptno from emp where ename=smith; 2)select dname from dept where deptno=20; 3)select dname from dept where deptno=(select dept from emp where ename=smith); 3-11-2010 1)Display the emp details who are working in DALLAS. a) select deptno from dept where loc=DALLAS; b) select ename from emp where deptno=20; ENAME -------SMITH JONES SCOTT ADAMS FORD 2)Display the location of king. a) select deptno from emp where ename=KING; DEPTNO --------10 b) select loc from dept where deptno=10; LOC

------------NEW YORK 3)Display the deptname of 7698 empno. a) select deptno from emp where empno=7698; DEPTNO -------30 b) select dname from dept where deptno=20; DNAME ------------RESEARCH Display the deptname in which is no any manager. select dname from dept where deptno not in(select deptno from emp where ename="MILLER"); In the about subquery we use in operate because inner query returns more than one value. JOINS In sub queries by taking data of one column and display another column of another table. Subqueries cannot display data of more than one table we use joins. Joins are of 3 types. 1)Simple join: a)equi join b)non equi join. 2)Self join 3)Outer join 1) Equi join : In this the two table are having one or more than one column with same name. Emp Deptno Dept Deptno Display the empno and their dept names? a) select eno,dname from emp1,dept1 where emp1.deptno=dept1.deptno; ENO DNAME ------- --------------

1 accounting 2)Non equi-join: In this join the two table are not having any common column. Emp Sal Salgrade Grade,losal,hisal Display ename sal,grade of employees? a) select ename,sal,grade from emp,salgrade where sal between losal and hisal;

ENAME SAL GRADE ---------- --------- --------SMITH 800 1 ADAMS 1100 1 JAMES 950 1 WARD 1250 2 MARTIN 1250 2 MILLER 1300 2 ALLEN 1600 3 TURNER 1500 3 JONES 2975 4 BLAKE 2850 4 CLARK 2450 4 SCOTT 3000 4 FORD 3000 4 KING 5000 5 3)Self Join: In this type join relation exists between columns in a table. Emp Mgr Emp Empno Here we need to create alias name to tables. Tablenm name Emp e,emp m,emp x,dept dt

Display employee names and their manager names? a) select e.ename "employee",m.ename "MANAGER" from emp e ,emp m where e.mgr=m.empno; employee MANAGER ---------- ------SMITH FORD ALLEN BLAKE WARD BLAKE JONES KING MARTIN BLAKE BLAKE KING CLARK KING SCOTT JONES TURNER BLAKE ADAMS SCOTT JAMES BLAKE FORD JONES MILLER CLARK 13 rows selected. In the above query it displays 13 employee records but emp table contains 14 records. KING employee doesnot have mgr(i.e. null) there is not employee with null empno that ways KING was not displayed. 4)Outer join: in joins if we cant get any records like above case ,then we use outer join,in condition just append symbol,it gives all the records. select e.ename "employee",m.ename "MANAGER" from emp e ,emp m where e.mgr=m.empno(+); employee MANAGER ---------- --------SMITH FORD ALLEN BLAKE WARD BLAKE JONES KING MARTIN BLAKE BLAKE KING CLARK KING SCOTT JONES KING TURNER BLAKE

ADAMS JAMES FORD MILLER

SCOTT BLAKE JONES CLARK

14 rows selected. 4-10-2009 1) Display the enames and working place of SALES? a) select ename,loc from emp,dept where emp.deptno=dept.deptno;

ENAME LOC ---------- ----------SMITH DALLAS ALLEN CHICAGO WARD CHICAGO JONES DALLAS MARTIN CHICAGO BLAKE CHICAGO CLARK NEW YORK SCOTT DALLAS KING NEW YORK TURNER CHICAGO ADAMS DALLAS JAMES CHICAGO FORD DALLAS MILLER NEW YORK 2)Display the employee details who was getting sal more than manager? a) select e.ename,e.sal,m.ename,m.sal from emp e,emp m where e.mgr=m.empno and e.sal>m.sal; ENAME SAL ENAME SAL ---------- --------- ---------- --------SCOTT 3000 JONES 2975 FORD 3000 JONES 2975 3)Display the grade of jones? a) select sal,grade from emp,salgrade where ename='JONES'and sal between losal and hisal; SAL GRADE ------ ---------

2975

4)Display the no. of employees in sal and every grade? a) select ename,sal,grade from emp,salgrade where sal between losal and hisal; ENAME SAL GRADE ---------- --------- --------SMITH 800 1 ADAMS 1100 1 JAMES 950 1 WARD 1250 2 MARTIN 1250 2 MILLER 1300 2 ALLEN 1600 3 TURNER 1500 3 JONES 2975 4 BLAKE 2850 4 CLARK 2450 4 SCOTT 3000 4 FORD 3000 4 KING 5000 5 5)Find the most expensive employee? 6) Find out the employee list and hisal working newwork? Course : course id Coursename Duration Total fee Minfee Faculty-course: Fid Courseid Counselor: Counselor id Counselor nm Doj Faculty: Fid facultyname addr phone exp

enquire course: enqno courseid Counselor id Batch Bid courseid Dostarting No.ofstudents Timings

1)display all the java batch details?

a)select * from batch where courseid=(select courseid from course where coursenm=java); 2)display the course details which duration <90 days? a)select * from course where duration<90; 3)Display the batch details which are handling by MOHAN? a)select * from batch where fid=(select fid from faculty where fnm=mohan); 4)Display the counseling the details of conselor name? a)select * from counselor where counselornm=x; 5)Display the course name handle by pradeep? a)select courseid from facultycourse where fid=(select fid from faculty where fnm=pradeep); 6)Display the enquire details of last two months? a) 7)Display the enquire details of course java? a)select * from enqcourse where courseid=(select courseid from course where coursenm=java);

8)Display the course details of latest fees among all the courses? a)select * from course where minfee=(select min(maxfee from course); 9)most experienced faculty phone number? a)select phone,max(exp) from faculty group by phone; 10)Display the batch details in which maximum students? a)select * from batch where noofstudents=(select max(noofstudents from batch); 6-10-2009 Database Objects Table is a primary database object and we have some secondary objects as follows. 1)view

2)synonym 3)index 4)sequence. 1)View: A View ia a virtual table or a view is a stored query. Syn: Create or replace view <viewname> as <select stmt>; Ex: 1)create view v as select empno,ename from emp; 2)Create view v as select ename,dname,grade from emp,dept,salgrade where emp.deptno=dept.deptno and sal between losal and hisal; ENAME DNAME GRADE ---------- -------------- --------SMITH RESEARCH 1 ADAMS RESEARCH 1 JAMES SALES 1 WARD SALES 2 MARTIN SALES 2 MILLER ACCOUNTING 2 ALLEN SALES 3 TURNER SALES 3 JONES RESEARCH 4 BLAKE SALES 4 CLARK ACCOUNTING 4 SCOTT RESEARCH 4 FORD RESEARCH 4 KING ACCOUNTING 5 14 rows selected. Or replaces is used to replaces the old select stmt with new select stmt. Create or replace view v as select ename from emp; To remove a view Syn: Drop view <viewname> Ex:

Drop view v; 2)Synonym: It is a duplicate name to an existing table when we do any change it will effect to original table. Syn: create synonym <synonym> for tablenm; Ex: Create synonym s for emp; Select * from s; Delete * from s; Select * from emp; No row selected To remove synonym: Syn: drop synonym <synonym name> Drop synonym s; 3)Index: An index is background process of secondary database object ,an index be applied to columns of a table.The column with unique and primary key are already indexed. It will help and provide data in complex queries on indexed columns. Syn: create index <indexname> on tablename(columnname); To remove index Syn: drop index <indexname>; 4)Sequence : it is a database object it generates sequence number,used to provide values for unique or primary key columns. Syn: create sequence <sequence nm> Start value ..1 Increment by ..1 Maxvalue.. 1027-1 We can specify start,increment,maxvalue as follows Syn: create sequence <sequence nm> start with no increment by no maxvalue no; Ex: create sequence seq start with 1 increment by 2 maxvalue 60;

Sequence contains two psudo columns to get nextvalue and presentvalue in the sequence Nextvalue Currval insert into saistud values(seq.nextvalue,'&sname',&marks); to change maxvalue of sequence alter sequence sequence maxvalue no to delete sequence syn: drop sequence seqnm; to display the next values or current value in a sequence. Ex: select seq.nextval from dual;

Set commands: Set verify on/off:It doesnt display old and new statements when we use & operator. Set feedback on/off: It doesnot display feed back number of rows. Set numwidth num: It sets numeric width Set serveroutput off/on: It display pl/sql output. Set sqlprompt name:To change sql prompt. Set time off/on: It displays time at sql prompt.

PL/SQL :

Procedural Language/Structure Query Language :Oracle backend is divided into 2 parts. 1)SQL 2)PL/SQL In SQL the queries are only single line querys are executed by SQL engine or SQL Command executed. In PL/SQL contains multilane commands which are executed by PL/SQL engine. SQL SERVER ` Resuest Rdbms<---PL/SQLdatabase objectdatabase Engine Rdbms<--- SQL Command executer ``````````````SQL Engine In PL/SQL 1)Variable Declarations 2)If Condition 3)Loopings 4)Cursors Management 5)Exception Handling 6)Database Objects.(functions,procedures,packages) PL/SQL program structure It contains 3 blocks 1)declare 2)begin 3)exception declare,exception are not must and

[declare .. . .variable declaration] begin . . .executable statement [exception .. .. ..exception handling] end; simple PL/SQL block begin dbms_output.put_line(DATAPRO); end; / Note :

Вам также может понравиться