FunctionWithRecord-dept - var DeptRecTyp begin var:=myfunc

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

View Full Document Right Arrow Icon
Sheet1 Page 1 /* a FUNCTION RETURNING A RECORD TYPE */ CREATE type DeptRecTyp as object( deptno NUMBER(2), dname VARCHAR2(14), loc VARCHAR2(13)) / CREATE OR REPLACE function MYFUNC RETURN DeptRecTyp is dept_rec DeptRecTyp cursor c1 is select * from dept BEGIN for dept_rec in c1 loop dbms_output.put_line(dept_rec.dname) dbms_output.put_line(dept_rec.deptno) dbms_output.put_line(dept_rec.loc) end loop return dept_rec END / ----CALLING ENVIRONMENTS------ SQL>select myfunc from dual ______________________________________________ -----from anonymous block------- declare
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: var DeptRecTyp begin var:=myfunc dbms_output.put_line(var.dname) dbms_output.put_line(var.deptno) dbms_output.put_line(var.loc) end / ___________________________________________________________________ Sheet1 Page 2 CREATE OR REPLACE FUNCTION MYFUNC RETURN emp_record_type IS TYPE emp_record_type IS RECORD (employee_id emp.empno%type, name emp.ename%TYPE, job_id emp.job%TYPE) emp_record emp_record_type BEGIN select empno,ename,job into emp_record from emp where empno=7369 dbms_output.put_line( end...
View Full Document

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 2

FunctionWithRecord-dept - var DeptRecTyp begin var:=myfunc

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