Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Uploading and Processing Text Files in Oracle APEX using File Browse Component

user-aucewJul 5 2023 — edited Jul 5 2023

Hello everyone,

I have a question about Oracle APEX and I was wondering if someone could help me solve it.

My goal is to upload a text file to a page using the 'File Browse' component, as long as the file extension is *.rem or *.txt. Additionally, I want to perform an ETL on the file, saving specific parts as variables and generating a JSON file to import into a table.

I tried to store the file in an 'APEX_APPLICATION_TEMP_FILES' table using the following SQL command in a process button:

DECLARE
l_file_content BLOB;
l_file_ext VARCHAR2(10);
BEGIN
-- Check the file extension
l_file_ext := SUBSTR(:P2_CNAB_FILE, INSTR(:P2_CNAB_FILE, '.', -1) + 1);

-- Check if the file extension is valid
IF l_file_ext IN ('rem', 'txt') THEN
-- Read the file content
l_file_content := UTL_FILE.FOPEN(APEX_APPLICATION_TEMP_FILES.LAST_UPDATED_BY, :P2_CNAB_FILE, 'r');

-- Implement the logic to extract and manipulate the data from the file

-- Display information about the loaded file
apex_application.g_print_success_message := 'File loaded successfully!';
apex_application.g_print_success_message_extra := 'File name: ' || :P2_CNAB_FILE;

-- Display the file content (for testing purposes only)
apex_application.g_print_success_message_extra := apex_application.g_print_success_message_extra || '<br/><br/>File content:<br/><pre>' || l_file_content || '</pre>';
ELSE -- Display an error message if the file extension is invalid apex_application.g_print_error_message := 'Invalid file. Please upload a file with extension ".rem" or ".txt".'; END IF; END;

However, I received the following error: ORA-06550: line 11, column 66: PLS-00302: component 'LAST_UPDATED_BY' must be declared.

Does anyone know how I can solve this problem? I've tried some solutions, but I still haven't been able to solve it.

Thank you in advance for your help!

Comments
Post Details
Added on Jul 5 2023
2 comments
2,482 views