I created a SQL object:
create type foo_type as object (
bar integer(2),
bar2 varchar(200),
member function get return integer
)
and I implemented my type's body:
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 a row:
INSERT INTO test_table (foo1) VALUES (foo_type(1, 'a'))
I would like that this is callable like this:
SELECT foo1.get() FROM test_table
but it doesn't works.
you have to use an alias when referencing type methods/attributes.
eg alias the table to t:
SQL> INSERT INTO test_table (foo1) VALUES (foo_type(1, 'a'));
1 row created.
SQL> select t.foo1.get() from test_table t;
T.FOO1.GET()
------------
1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With