How to use oracle type username function
I created a SQL object:
create type foo_type as object (
bar integer(2),
bar2 varchar(200),
member function get return integer
)
and I have implemented a body of my type:
CREATE TYPE BODY foo_type as
member function get return integer is
begin
return bar;
END;
END;
Then I created a table with this type:
CREATE TABLE test_table(
foo1 foo_type
)
and I inserted the line:
INSERT INTO test_table (foo1) VALUES (foo_type(1, 'a'))
I would like it to be called like this:
SELECT foo1.get() FROM test_table
but it doesn't work.
+3
source to share