4

I have an SQL function, which returns an object.

select some_function(acctID) from dual;

The above returns an object like

[CISADM.CM_MTR_READ_OBJ]

I need to get individual values from the object.

3
  • the funtion is very big i'll add the returning object Commented Oct 25, 2013 at 6:41
  • return_obj := cm_mtr_read_obj(readdttm, reg_reading, read_type, reader_rem_cd); RETURN return_obj; Commented Oct 25, 2013 at 6:42
  • Check this link for reading value in Java Commented Oct 25, 2013 at 6:44

1 Answer 1

5

How the returning result is displayed heavily depends on a client you are using to execute that query. It would be better if you explicitly specified those properties of an object instance you want to be displayed. For example:

create or replace type T_Obj as object(
  prop1 number,
  prop2 date
)  

create or replace function F_1(
   p_var1 in number,
   p_var2 in date
 ) return t_obj is
 begin
   return t_obj(p_var1, p_var2);
 end;

select t.obj.prop1
     , t.obj.prop2
 from (select F_1(1, sysdate) as obj
         from dual) t

result:

 OBJ.PROP1  OBJ.PROP2
----------  -----------
         1  25-Oct-2013
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.