I used the information oracle 2.2

sponsored links
/****************************** 1. According to department inquiries sector information *********** ID ******************/
type empcur is ref cursor;
v_cur empcur;
v_type naemp% rowtype;
v_no int;
v_no: = & Please enter the sector number;
open v_cur for select * into v_type from naemp where empno = v_no;
fetch v_cur into v_type;
while v_cur% found
dbms_output.PUT_LINE (v_type.empno | | '' | | v_type.empdeptno | | '' | | v_type.empname | | '' | | v_type.empsal | | '' | | v_type.empmanager);
fetch v_cur into v_type;
end loop;
close v_cur;
/**************************** 2. According to the information and determine the number check wage scale *********** **************/
type emp_cur is ref cursor;
v_cur emp_cur;
v_sal naemp.EMPSAL% type;
v_no naemp.empno% type;
v1 nanemp% rowtype;
v_grade varchar2 (4);
/ * The ID check salary * /
v_no: = & Please enter the sector number;
open v_cur for select empsal from naemp where empno = v_no;
fetch v_cur into v_sal;
dbms_output.PUT_LINE (v_sal);
close v_cur;
/ * Determine the salary level * /
open v_cur for select * from nanemp;
fetch v_cur into v1;
while v_cur% found
v_grade: = case
when v1.empsal> = 10000 then 'A'
when v1.empsal> = 8000 then 'B'
when v1.empsal> = 5000 then 'C'
when v1.empsal> = 2000 then 'D'
else 'E'
dbms_output.PUT_LINE (v1.empname | | 'wage level is' | | v_grade);
fetch v_cur into v1;
end loop;
close v_cur;
/***** With the exception handling of the wage scale inquiry ***********/
type v_cursor is ref cursor;
v_cur v_cursor;
v_row naemp% rowtype;
v_level varchar2 (2);
v_no number;
v_no: = & Please enter the sector number;
open v_cur for select empno, empname, empdeptno, empsal, empmanager from naemp where empno = v_no;
fetch v_cur into v_row;
if v_cur% notfound then
raise no_data_found;
end if;
dbms_output.PUT_LINE (v_row.empsal);
v_level: = case
when v_row.empsal> = 10000 then 'A'
when v_row.empsal> = 8000 then 'B'
when v_row.empsal> = 5000 then 'C'
when v_row.empsal> = 2000 then 'D'
else 'E'
dbms_output.PUT_LINE ('the employee's wage level is now:' | | v_level);
close v_cur;
when no_data_found then
dbms_output.PUT_LINE ('Sorry! not the employee!');
when others then
dbms_output.PUT_LINE ('Unknown error!');
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of I used the information oracle 2.2

  • Rails2.0.2 change the default DB adpter

    In Rails2.0.2 rails demo ... ... MissingSourceFile in SayController # hello no such file to load - sqlite3 RAILS_ROOT: / home / kenb / rails-projects / demo ... ... Checked config / database.yml, adpter default is set become the sqlite3. Check the ra ...

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • Software development sunflower Baodian [reprint]

    Master the ability to reuse code very familiar with the new API's fast. This is because, he once used a lot of the API, have a lot of reusable code. He knows what is available and what is deficient. He has been using Qt, also used by gtk +, also used

  • The company first entered the company I would like to Optimize SQL project

    I was a time not long into the company of people, but also a person to be graduated, but immediately entered the project team, involved in the development. The project is to make a China Telecom Operation System, is a big system. My so-called develop ...

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • Oracle instant clent for ruby / rails on cygwin

    Environment: XP: oracle full client, ruby, rails, gem cygwin: ruby rails, gem (the version with the XP version) Needs: for cygwin is installed under the rails platform support oci Steps: <1> download oracle instant client ( Instant Client Pa

  • spring + hibernate + oracle9i to read and write CLOB

    Database-driven update classes12-9i.jar Hibernate modify the configuration of the following code <bean/> <bean Lazy-init="true"> <property name="nativeJdbcExtractor"> <ref local="nativejdbcExtractor"/>

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @

  • can not be represented as java.sql.Timestamp

    Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries