sql - Using an object type in a select statement in Oracle -


I have a function that returns an object with 3 values. Is there a way to call that function with a selection statement, and each value is a different column? I could break it in 3 functions, but the value is related, so I wanted to put it as one for display reasons. (I.e., Oracle does not need to call 3 identical complex functions for every line in the query.)

Type the following:

  Type test_obj object (a number, B NUMBER, C NUMBER); Create test_func or replace function (pinput number) with return test_obj returns test_obj (0, 0, 0); End test_func;  

I want to be able to call test_func from a select statement, but sometimes without calling the function, there can be columns A, B and C. I probably thought of something like that, but it does not work: choose

  iv.col1, iv.col2, iv.func_data.a, iv.func_data.b, iv.func_data.c From (Select MT Col1, mt.col2, test_func (mt.input) as func_data from my_table mt) iv  

Any method of doing something like this in Oracle 10G Is there a better way to solve this problem?

Select statement in question will work This failed because I did not include aliases for inline view .

This will work for any reason:

  select iv.func_data.a, iv.func_data .b, iv.func_data.c (my_table form of func_data from MT Select test_func (mt.input)) iv  

but it will not:

  select Func_data.a, func_data.b, func_data (Test_func (mt.input) from .c (choose func_data from my_table mt)  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -