Skip to main content

Invalid reference to Oracle Forms object

ZPA rule for PL/SQL and Oracle SQL · InvalidReferenceToObject

In Oracle Forms, many built-ins take the name of a form object (an alert, a block, an item or a list of values) as a character value. The compiler does not check these names: a name that is misspelled, or that was renamed or removed from the form, compiles and fails only when the code runs.

This rule reports a name written as a string literal that the form does not have, compared case-insensitively. An item is named with its block, as 'block.item'. Names built at run time are not checked. The rule runs only when Oracle Forms metadata is given: the sonar.zpa.forms.metadata property in SonarQube, or the --forms-metadata option of zpa-cli. The checked built-ins are:

  • Alerts: FIND_ALERT, SET_ALERT_BUTTON_PROPERTY, SET_ALERT_PROPERTY, SHOW_ALERT.
  • Blocks: FIND_BLOCK, GET_BLOCK_PROPERTY, GO_BLOCK, SET_BLOCK_PROPERTY.
  • Items: CHECKBOX_CHECKED, CONVERT_OTHER_VALUE, DISPLAY_ITEM, FIND_ITEM, GET_ITEM_INSTANCE_PROPERTY, GET_ITEM_PROPERTY, GET_RADIO_BUTTON_PROPERTY, GO_ITEM, IMAGE_SCROLL, IMAGE_ZOOM, PLAY_SOUND, READ_IMAGE_FILE, READ_SOUND_FILE, RECALCULATE, SET_ITEM_INSTANCE_PROPERTY, SET_ITEM_PROPERTY, SET_RADIO_BUTTON_PROPERTY, WRITE_IMAGE_FILE, WRITE_SOUND_FILE.
  • Lists of values: FIND_LOV, GET_LOV_PROPERTY, SET_LOV_COLUMN_PROPERTY, SET_LOV_PROPERTY, SHOW_LOV.

Examples​

Noncompliant Code Example
-- The form has the block CRATE with the item CODE.
begin
go_item('crate.crate_code'); -- Noncompliant
end;
Compliant Solution
begin
go_item('crate.code');
end;