Forum Stats

  • 3,770,291 Users
  • 2,253,091 Discussions
  • 7,875,393 Comments

Discussions

How to access Oracle object?

JackK
JackK Member Posts: 678 Bronze Badge

Hi!

create or replace type t_test as object (
  n1 number(1),
  n2 number(2)
);

SELECT sq.* from (
  with d(tp) as (
  SELECT t_test(1, 11) FROM dual UNION ALL
  SELECT t_test(2, 12) FROM dual UNION ALL
  SELECT t_test(3, 13) FROM dual
)
SELECT * FROM d) sq;

When using JDBC, how may Java programmer access the returned data?

I have information from my colleague that there is no TP.N1 or TP column in the result.

I don't want to use

SELECT sq.tp.n1 AS n1, sq.tp.n2 AS n2 from (
  with d(tp) as (
  SELECT t_test(1, 11) FROM dual UNION ALL
  SELECT t_test(2, 12) FROM dual UNION ALL
  SELECT t_test(3, 13) FROM dual
)
SELECT * FROM d) sq;

because this takes much more time to execute, when there is more object's attributes.

Regards,

Jacek

Answers