{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


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 Document Right 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(emp_record.name) end...
View Full Document

{[ snackBarMessage ]}