I'm creating some procedures and functions to make easier the tasks of inserting, deleting or updating rows.My question could sound silly because sure there's something I'm missing. So my query has a listagg function that is returning a list of elements, I have added one more column using substr to fetch the latest record from the listagg. I am trying to get the first record from the list return by listagg().Rather than being a scalar value, it is itself an object.So I can obtain the value of an attribute of that object by using dot notation once again, followed by the name of that attribute: I have declared a nested object type table that has three columns of datatype number, varchar2, and another object, respectively.DECLARE -- A locally defined varray initialized with no elements.l_one_day_of_meals meals_vat := meals_vat ( ); BEGIN -- Make room for the three meals. EXTEND ( 3 ); -- Add breakfast, using the constructor for both the meal -- and within it the food object type instance.
Converting it to a varchar is helping, however getting the data ...
Technically, under the covers, at the most "basic level", they are the same. Ref cursors may be dynamically opened or opened based on logic.
Declare type rc is ref cursor; cursor c is select * from dual; l_cursor rc; begin if (to_char(sysdate,'dd') = 30 ) then open l_cursor for 'select * from emp'; elsif ( to_char(sysdate,'dd') = 29 ) then open l_cursor for select * from dept; else open l_cursor for select * from dual; end if; open c; end; / A ref cursor is a variable, defined as a cursor type, which will point to, or reference a cursor result.
The advantage that a ref cursor has over a plain cursor is that is can be passed as a variable to a procedure or a function.
The ref cursor can be assigned to other ref cursor variables.