I have a query that selects sequences of paragraphs based on their order, i want to know if there is a better performing way of doing the same thing. any help or comments is appreciated.

tables:

OMS_MENUITEMS
-------------
ID
NAMEE
NAMEF

OMS_MENUITEMREFERENCES
----------------------
MENUITEM_ID
SECTION_ID
FIRSTPARAGRAPH_ID
LAST_PARAGRAPH_ID

OMS_SECTIONS
------------
ID
NAMEE
NAMEF
SECTIONORDER

OMS_PARAGRAPHS
--------------
ID
SECTION_ID
TEXTE
TEXTF
NAMEE
NAMEF
PARAGRAPHORDER
NAMEF


The basic jist is that you have sections (chapters of a manual) which contain paragraphs. The sections and paragraphs or ordered by a numeric key in the SECTIONORDER or PARAGRAPHORDER columns. There is also a menu that lists the sections, when a menuitem is clicked on i need to get the paragraphs referenced by that menuitem. In the OMS_MENUITEMREFERENCES table the firstparagraph_id can be null or point to a paragraph id, same for the lastparagraph_id. Based on the id of the paragraphs in the first and last columns i need to get all paragraphs that are between the order of the specified paragraphs. If the firstparagraph_id is null it means get them from order 0 to the lastparagraph_id, if the lastparagraph_id is null it means get them from the first to the last one (thats where i used the decode from 0 to 1000000).

SELECT OMS_PARAGRAPHS.ID,
OMS_PARAGRAPHS.SECTION_ID,
OMS_PARAGRAPHS.NAMEE
OMS_PARAGRAPHS.TEXTE OMS_PARAGRAPHS.PARAGRAPHORDER,
OMS_SECTIONS.SECTIONORDER
FROM OMS_PARAGRAPHS,
OMS_SECTIONS,
OMS_MENUITEMREFERENCES
WHERE OMS_MENUITEMREFERENCES.MENUITEM_ID = pi_menuitem_id
AND OMS_SECTIONS.ID = OMS_MENUITEMREFERENCES.SECTION_ID
AND OMS_PARAGRAPHS.SECTION_ID = OMS_SECTIONS.ID
AND OMS_PARAGRAPHS.ID IN (SELECT PRGH.ID
FROM OMS_PARAGRAPHS PRGH
WHERE PRGH.PARAGRAPHORDER >= (SELECT a.PARAGRAPHORDER FROM OMS_PARAGRAPHS a WHERE a.id = DECODE(OMS_MENUITEMREFERENCES.FIRSTPARAGRAPH_ID, null, 0, OMS_MENUITEMREFERENCES.FIRSTPARAGRAPH_ID))
AND PRGH.PARAGRAPHORDER <= (SELECT b.PARAGRAPHORDER FROM OMS_PARAGRAPHS b WHERE b.id = DECODE(OMS_MENUITEMREFERENCES.LASTPARAGRAPH_ID, null, 1000000, OMS_MENUITEMREFERENCES.LASTPARAGRAPH_ID)))
ORDER BY OMS_SECTIONS.SECTIONORDER, OMS_PARAGRAPHS.PARAGRAPHORDER;