Skip to Main Content

Clean WWV_FLOW_FILES when validation errors on file upload

I was participating The "Ask the ClariFit Experts" Webinar where Martin Giffy D'Souza and Chris Hritzuk was presenting PL/SQL, SQL and APEX tricks.

Martin did present good tip "tag" files uploaded to WWV_FLOW_FILES using On Submit and Before Computation page process. That way you can easily later identify and delete files left to WWV_FLOW_FILES if validation error is raised on upload page and all page processes are not run. He have also previous write blog post relating topic.

I have used for this purpose code in validation. This validation is run only if some other validation is not passed. Actually this code is not for validating anything and never raise error. Code is on validation section because APEX page processing logic on page submission. It is important that this validation block have highest sequence number that it is executed last.

Create page level new validation.

Step 1

Set Display Error Location to On Error Page. NOTE! Make sure this validation sequence number is highests of validations on page.

Step 2

Validation type PL/SQL.

Step 3

Select PL/SQL Error.

Step 4

Validation code:

DELETE FROM wwv_flow_files
WHERE name = :Px_FILE_BROWSER
; 

Remember change Px_FILE_BROWSER to be you file browser item name.

Enter something to Error Message. It is not important as this is not actual validation.

Set Always Execute to Yes.

Step 5

Set condition Inline Validation Errors Displayed.

Step 6

Now WWV_FLOW_FILES keep clean even end user gets some validation errors when uploading file. This trick is very useful for form pages where user enter data and load files to database.

Comments

  • Helios Hyperion 8 Apr 2013
    Thank you so much for this! Exactly what I needed. Saved me from so much trouble. Just what the doctor ordered! :D