Friday, April 29, 2011

how to run pl sql

SQL> set serveroutput on
SQL> @c:\seit\abc.sql;
SQL> DECLARE
2 Cursor ecursor is select ename,sal from emp order by sal desc;
3 name emp.ename%type;
4 sal emp.sal%type;
5 BEGIN
6 open ecursor;
7 DBMS_OUTPUT.put_line('top 5 paid employees');
8 For I In 1..5
9 Loop Fetch ecursor into name,sal;
10 DBMS_OUTPUT.put_line(name);
11 DBMS_OUTPUT.put_line(sal);
12 End loop;
13 END;
14 /
top 5 paid employees
KING
5000
SCOTT
3000
FORD
3000
JONES
2975
BLAKE
2850

PL/SQL procedure successfully completed.

No comments:

Post a Comment

Lecture PPTs of MIS , Module 4 to Module 6

 Module 4 Social Computing (SC): Web 3.0 , SC in business-shopping, Marketing, Operational and Analytic CRM, E-business and E-commerce B2B B...