Posted By: nofu1 how to create an object in a package - 08/26/10 03:03 PM
Dear all; I know how to do this in oracle but I am having a difficult time doing this in pl/sql developer. how do you create a user-defined type object in pl/sql developer. i can provide you with the oracle syntax below. Thank you.

CREATE OR REPLACE TYPE emp_t AS OBJECT
( ename VARCHAR2 (20)
, job VARCHAR2 (20)
, empno NUMBER
);
/

CREATE OR REPLACE FUNCTION get_emp_t
( in_empno IN scott.emp.empno%TYPE
)
RETURN emp_t
AS
return_rec emp_t;
BEGIN
SELECT ename, job, empno
INTO return_rec.ename, return_rec.job, return_rec.empno
FROM scott.emp
WHERE empno = in_empno;

RETURN return_rec;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN NULL;
END get_emp_t
;
/

In the SQL Window and Command Window you can simply execute the code you mentioned.

In the Program Window you can enter each separate program unit in a separate tab page, and remove the trailing slash. If you have the code above in a file and open it in a Program Window, it will already be separated into 2 tab pages without slashes.
© Allround Automations forums