Print Thread
how to create an object in a package
#38639 08/26/10 03:03 PM
Joined: Aug 2010
Posts: 2
N
nofu1 Offline OP
Member
OP Offline
Member
N
Joined: Aug 2010
Posts: 2
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
;
/


Re: how to create an object in a package
nofu1 #38649 08/27/10 11:03 AM
Joined: Aug 1999
Posts: 22,194
Member
Offline
Member
Joined: Aug 1999
Posts: 22,194
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.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.019s Queries: 15 (0.005s) Memory: 2.4973 MB (Peak: 3.0394 MB) Data Comp: Off Server Time: 2024-04-16 23:20:23 UTC
Valid HTML 5 and Valid CSS