Reputation: 477
I declared emp_obj as rowtype of emp_table (which has x number of columns), however I want emp_obj to have x minus y columns (i.e. fewer colunms). How do I go about? My code is:
DECLARE emp emp_table%ROWTYPE;
BEGIN
SELECT name,
surname
INTO emp_obj
FROM emp_table
WHERE emp_ID='89545585'
AND ROWNUM=1;
END;
Upvotes: 1
Views: 70
Reputation: 23588
You can specify the fields to store the columns in, e.g.:
DECLARE emp emp_table%ROWTYPE;
BEGIN
SELECT name,
surname
INTO emp_obj.name,
emp.surname
FROM emp_table
WHERE emp_ID='89545585'
and ROWNUM=1;
END;
Upvotes: 3