Link to home
Create AccountLog in
Avatar of talahi
talahi

asked on

Oracle Objects and using dot notation

I'm trying to understand how to use objects in Oracle and curious why the following example doesn't work.  Or what is missing that would make it work using Objects and dot notation.

create table comments_table
(dat date,
 comments varchar2(200));

declare
  type ser_table is table of varchar2(10) index by binary_integer;
  ser_list   ser_table;
  temp_count integer := 0;
begin
  ser_list(1) := 'TEST 1';
  ser_list(2) := 'TEST 2';
  ser_list(3) := 'TEST 3';

  -- Doesn't work
  insert into comments_table(dat,comments) values(sysdate,ser_list.count||' records inserted.');

  -- Does work
  temp_count := ser_list.count;
  insert into comments_table(dat,comments) values(sysdate,temp_count||' records inserted.');

end;
ASKER CERTIFIED SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
you cannot use an object as a part of a string, you need to convert it to a variable first before you can use it
ser_list.count is a property of an object
Avatar of talahi
talahi

ASKER

Ok thanks.