This is a short post about a strange behavior I discovered today…

The fact is that it is not really possible to use the named notation with the SEM_MATCH table function. In fact, even though the parameter’s names can be specified, the order of the parameters overrides the specification done with the named notation!?!

Here is an example:

  • With positional notation everything works as expected
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match('SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              sem_models('SEMDEMO_WORK'),
  5              NULL,
  6              sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              NULL
  8    )
  9  );

  COUNT(*)
----------
       601
  • The named notation seems to be supported… (notice that the parameters are specified in the same order as they are defined in the table function)
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              rulebases => NULL,
  6              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              filter    => NULL
  8    )
  9  );

  COUNT(*)
----------
       601
  • … but when the parameters are not specified in the same order as they are defined (the RULEBASES and ALIASES parameters were swapped), a PLS-00306 is raised!
SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  6              rulebases => NULL,
  7              filter    => NULL
  8    )
  9  );

SELECT count(*)
*
ERROR at line 1:
ORA-06550: line 4, column 13:
PLS-00306: wrong number or types of arguments in call to 'ODCITABLEDESCRIBE'
ORA-06550: line 4, column 6:
PL/SQL: Statement ignored

As a result, even though using the named notation is better for readability, the order of the parameters cannot be changed! I’m puzzled.

Update 2013-06-21: bug 16996604 (NAMED PARAMETERS DISCARDED BY ODCITABLEDESCRIBE AND PREPARE) was opened to track this issue.