Nikorn Ass2

Nikorn Ass2 - Assignment-2submission dt-25th june by Mr...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment-2- submission dt-25th june by Mr Nikorn Rongbutsri AST JAN 05 1. load the employee names and salaries into plsql table and then display the contents of the table DECLARE type rec is record( ename emp.ename%type , sal emp.sal%type); TYPE table_type IS TABLE OF rec index by binary_integer; empv table_type; i binary_integer:=0; begin for rec in(select ename,sal from emp) loop i:=i+1; empv (i).ename :=rec.ename; empv (i).sal :=rec.sal; dbms_output.put_line('Ename:' || empv(i).ename || ' Salary:' || empv(i).sal ); end loop; end; / 2. declare a record type to hold common student information, assign values and display them DECLARE type stRec is record( stName varchar2(20) , stSurname varchar2(20), stAdd varchar2(80), stAge number, stBOD date, stPhone varchar2(20)); st1 stRec; BEGIN st1.stName:=’Nikorn’; st1.stSurname:=’Nikorn’; st1.stAdd:=’Rongbutsri’; st1.stAge:=25; st1.stBOD:=to_date(’27/10/80’,’dd/mm/yy’); st1.stPhone:=’234324234’; dbms_output.print_line(‘Name: ’ || st1.stName);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
dbms_output.print_line(‘Surname: ’ || st1.stSurname);
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Nikorn Ass2 - Assignment-2submission dt-25th june by Mr...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online