views:

252

answers:

1

I need to handle some somewhat compliclated parameter validation requirements. We are using SQL reporting 2005 against an Oracle 8.1 DB.

The user must not select a date range longer than a year Either FooParm must be supplied or Codes must be supplied and the difference between CodeStart and CodeEnd must be less than 1001

In a pseudo code format

(dateStart and dateEnd DIFF < 1 year AND !=0) 

AND 

(
   (FooParm !=0) 
   OR 
   (CodeStart AND CodeEnd < 1001 AND CodeStart!='' AND CodeEnd!='')
)

From what I've seen, the only way to achieve this is from a custom front end, but we already have one and it will not be modified for this request.

I'm wanting to create an Oracle procedure that will check and return an error stating the problem.

Will an error be raised to the user? I am assuming it will just be written to an error log and the user will be shown the default error page.

I could possibly return a recordset with the relevant error message in it.

Any other ideas? I'm no reporting pro, so I may be going about this all wrong.

+1  A: 

I would have thought a call to RAISE_APPLICATION_ERROR would make it's way to the user?

BEGIN
    IF <your-parameter-validation> THEN
        RAISE_APPLICATION_ERROR (
            num=> -20501,
            msg=> 'Parameters are incorrect etc.');
    END IF;

   <continue-your-code>

   ...

This worked for us when we were using Crystal Reports to call a PL/SQL function.... hopefully will work for you.

cagcowboy
Worked just fine.
Sam