1

I've come across the below code snippet in utPLSQL website.

procedure test_cur_skip_columns_eq is
  l_expected sys_refcursor;
  l_actual   sys_refcursor;
begin
  open l_expected for select 'text' ignore_me, d.* from user_tables d;
  open l_actual   for select sysdate "ADate",  d.* from user_tables d;
  ut.expect( l_actual ).to_equal( l_expected ).exclude( 'IGNORE_ME,ADate' );
end;

procedure test_cur_skip_columns_cn is
  l_expected sys_refcursor;
  l_actual   sys_refcursor;
begin
  open l_expected for select 'text' ignore_me, d.* from user_tables d where rownum = 1;
  open l_actual   for select sysdate "ADate",  d.* from user_tables d;
  ut.expect( l_actual ).to_contain( l_expected ).exclude( 'IGNORE_ME,ADate' );
end;

It has this line of code with dot notation, ut.expect( l_actual ).to_contain( l_expected ).exclude( 'IGNORE_ME,ADate' );. I read some oracle docs for the usage of dot notation and everywhere it says package_name.object_name or schema_name.table_name. But the above mentioned line of code doesn't look like any of these. I am interested to know what are those objects between each dots. Any help is appreciated.

default locale
  • 13,035
  • 13
  • 56
  • 62
Krishy
  • 23
  • 1
  • 5

1 Answers1

2

I am interested to know what are those objects between each dots.

These are, indeed, oracle objects (aka user-defined types, aka abstract data types).

ut.expect( l_actual ).to_contain( l_expected ).exclude( 'IGNORE_ME,ADate' );

What happens here:

  • package ut contains a function named expect that returns an object of type ut_expectation_compound;
  • ut_expectation_compound is a type that defines two member functions: to_contain and exclude. Both of them return ut_expectation_compound which allows the method calls to be chained like this.

You might want to read the Object-Relational Developer's Guide to get an introduction into the topic. Also read PLSQL Language Reference - it should provide an answer for most of your questions about PLSQL syntax.

default locale
  • 13,035
  • 13
  • 56
  • 62