HTMLDB csv import using apex_plsql_jobs

I am using the csv_file_upload tool from:

http://dbswh.webhop.NET/HTMLDB/f?p=blog:files:0:

When I press the download button to download the csv file and put it in a htmldb_collection, I want she runs inside an apex_plsql_job. Because when I try to download a csv file larger then a 4, 5000 lines I have run in the time-out for the server web apache.

declare

l_sql varchar2 (4000);

number of l_job;

Start

l_sql: =.

'

BEGIN

() csv_util.upload

p_file_name = > "' | : p1_file | ''',

p_collection_name = > "' | "CSV_DATA" | ''',

p_enc_by = > "' | : p1_enclosed | ''',

p_sep_by = > "' | : p1_separator | ''',

p_rows = > "' | : p1_lines | '''

);

END;

';

l_job: =.

() apex_plsql_job.submit_process

p_sql = > l_sql,

p_when = > sysdate,.

p_status = > 'background subject process. "

);

exception

while others

then

raise_application_error (-20001, 'an error has occurred -' | sqlcode |) "- ERROR -" | SQLERRM);

end;

1, 38601552744268E151091, 32263028543094E15COMP_QTGAPEX_PUBLIC_USER18/10/2013-12:59:2118/10/2013-12:59:2118/10/2013-12:59:24Subject background processALL THE18/10/2013-12:59:24(HUGECLOB)

I see that the job is done but even with 1 line in the csv file that is never treated. Without the apex_plsql_job of the sample application provided with the csv download tool works very well.

Help?

THX.

APEX_PLSQL_JOB is a wrapper of DBMS_JOB.

Everything that is true for DBMS_JOB applies to the APEX_PLSQL_JOB.

If you read the free documentation on APEX_PLSQL_JOB, you will realize that the process runs outside any environment of APEX.

This means that the work doesn't have access to the collections of your session.

Basically, you need to put EVERYTHING in the process you are calling.  Including the final INSERTION... SELECT statement.

due to the potential complexity, you better put that in a procedure (in a package) and call this procedure through APEX_PLSQL_JOB.

Since you have parameters, you must store these values in a table.

TABLE

In your case, the "table setting" will look like this:

create table PARAMETER_TABLE (
  job_id int primary key
,enclosed_by varchar2(4)
,separated_by varchar2(4)
,new_lines varchar2(8) -- i'm guessing this is what p_rows means
,actual_file BLOB
);


PROCESS OF

The process that you call should look like this:

DECLARE
  l_job_id int;
BEGIN
  -- set up JOB
  l_job_id := APEX_PLSQL_JOB.submit_process( 'BEGIN  process_csv( JOB ); END;' );
  -- note : JOB doesn't start until you call COMMIT

  -- Record the parameters for the job
  -- and copy file from WWV_FLOW_FILES into the PARAMETER_TABLE
  insert into parameter_table (job_id, enclosed_by, separated_by, new_lines, actual_file
  select l_job_id, :p1_enclosed_by, :p1_separator, :p1_lines, W.file
  from wwv_flow_files where filename = :p1_file; -- you'll need to double check my code.  I'm writing from memory.

  -- delete file from wwv_flow_files
  -- i'm just going to skip typing this out.
END;


PROCEDURE

Here is the trick... all data are stored in the PARAMETER_TABLE.

When you call DBMS_SUBMIT, there are a few variables that are already installed.

Again, APEX_PLSQL_JOB is a wrapper for DBMS_SUBMIT.

One of these variables is WORKING... it is the JOB_ID of the task running argument.

This value allows you to find the right parameters to run.

(reminder: it can get complicated.)  Put it in a package.)

create or replace
procedure process_csv( p_job_id in int )
as
  l_enclosed_by  parameter_table.enclosed_by%TYPE;
  l_separated_by parameter_table.separated_by%TYPE;
  l_new_lines    parameter_table.new_lines%TYPE;
  l_file_blob      parameter_table.actual_file%TYPE;
begin
  -- get actual parameters for this run
  select enclosed_by, separated_by,new_lines,file_blob
    into l_enclosed_by, l_separated_by, l_new_lines, l_file_blob
  from PARAMETER_TABLE
  where job_id = p_job_id;

  -- do something with them
  -- this will have to be different than the parser you've written

  -- delete data from parameter_table
  -- i'm sure you can write this code

end process_csv;

Note: csv_util is not a standard Oracle package.  You will need one that does not have collections

ORA-00001: Unique constraint violated: SELECT * FROM worksheet (or how to parse a CSV using PL/SQL)

Tags: Database

Similar Questions

  • How to import blackBerry smartphones. CSV file using Desktop Manager 4.6?

    Hello

    I'm new to Blackberry and I recently bought.  I exported my cell phone contact into a .csv file?

    Please tell us how to import. CSV file using Desktop Manager 4.6?

    I used

    Hi tahir, you must import the csv file into outlook first use and after outlook synchronization with desktop Manager.

  • How to use 'Import using Windows' instead of using the Live format?

    original title: "IMPORT to WINDOWS HELP."

    With my old computer, operating system Windows Vista, I was able to import pictures from a camera, DVD or CD, by "Import Windows using". It worked very well, and I liked the format of the Gallery of images produced, in particular space readily available for more information (title, date & tags).

    When Windows Live became available as an option, I DELIBERATELY chose to use 'The window using import', rather than 'Import using Windows Live', that I did not like this product format.
    When I had to buy a new computer, running on Windows 7, I find that I am completely restricted import using "Windows Live".
    Y at - there no way to return to importing photos using Windows rather than in the "live" format that seems necessary?
    Thanks for any help and assistance, someone can give.

    If it is not listed in the Autoplay download another program like google picasa... of photo editing and manually copy / paste the files that you want by using windows Explorer.

  • I mplease sir help it sound my fold important using window 7

    Hi Sir... actully I have my folder in my pen drive.4 day there I did also my USB into my laptop and then copied my file important my disk of prn to laptop and I think that virus is next to my laptop or pn drive dat y next day when I opened my this important issue folder.i dat see is empty.den again once I copy this folder on my laptop computer for USB see again the dat folder is enpty.after den I didn't click on this folder and den clicked on "Run as Administrator" is laugh when I did copy this folder then see the notification "to copy this folder administrator permission" and there were 3 option continiue skip and cancel. so I pressed on continue 4 5 times. and in this time folder is not show in my USB. amplifier. I mplease sir help it sound my fold important using window 7

    Hi John,.

    I'm sorry to hear that you are facing this problem with one of your important files. I'll certainly try and help you recover the file.

    Plug the USB and run a scan complete using the scan Microsoft Security check for infections.

    Note: there is a risk of data loss if all the files are infected and which can be removed in the cleaning process.

    Sometimes, when pen drives be infected by some kind of virus, it can replicate this folder in the drive and hide the original file. You can follow the steps in the article to view hidden folders and check if it helps.

    Hope this information was helpful and let us know if you need more assistance. We will be happy to help you.

  • Convert .xls in .csv file using pl/sql or any other method (oracle 9i)

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production

    With partitioning, OLAP and Oracle Data Mining options

    Release 9.2.0.8.0 - Production jserver

    10.1.2.0.2 generator

    ORACLE Server Release 10.1.0.4.2

    Oracle 10.1.2.0.2 procedure generator

    Oracle ORACLE PL/SQL V10.1.0.4.2 - Production

    Oracle 10.1.0.4.0 Production CORE

    Integration Services 10.1.2.0.2 tools Oracle

    Space common tools Oracle 10.1.2.0.2

    Oracle Toolkit 2 for 32-bit Windows, 10.1.2.0.2 platforms

    Resource object 10.1.2.0.2 store

    Oracle Help 10.1.2.0.2

    Oracle Sqlmgr 10.1.2.0.2

    Query Oracle 10.1.2.0.2 - Production Designer

    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)

    Oracle ZRC 10.1.2.0.2

    Oracle XML Developers Kit 10.1.0.4.2 - Production

    Virtual graphics system Oracle 10.1.2.0.2

    Image of Oracle 10.1.2.0.2

    Widget media Oracle 10.1.2.0.2

    The GUI utility 10.1.2.0.2 tools Oracle

    I had seen a very old post of 2009.

    Convert .xls in .csv file using pl/sql

    I know that it s a long time but just wanted to know if there is a way to convert excel .csv.

    I have a directory say 'F:\purple_top\ '. I'll get the .xls file in this directory. I need to change to .csv and tables load external oracle. Any ideas or advance coding on it since 2009 so far?

    A few other options might be:

    • Java code, which can be used from within Oracle, which makes use of utility libraries (e.g. Aspose.Cells) open source (for example Apache POI) or "save under" CSV, or read the source cells and their output to a CSV file.
    • COM Automation, using available open source (for example, JACOB or j-interop) or commercial libraries, which can automate Excel to open a XLS file and "Save as" a CSV file. In addition, Oracle has a feature of COM Automation (available since version 8 but abandoned after Oracle 11g). I have successfully used this read (non-macro-enabled) Excel files in PL/SQL.
    • Other approaches using Perl or PHP can be found by googling 'convert xls to csv.

    Gerard

  • ODI smart import using sdk

    I'm getting smart import using code below

    New SmartImportServiceImpl impl = SmartImportServiceImpl (odiInstance);

    String xmlfile = ' C: / users/608600862/Desktop/xml/SmartExport"; "

    impl. importFromXml (xmlfile);

    me gives following error

    Untitled.png

    If I import the same exported file using the ODI studio, he is transferred successfully

    I googled a lot but no luck

    Please help me solve this error

    SmartExport works well, but SmartImport above gives me error

    exported file is generate using the smart studio odi export option

    I read somewhere that we must be used SAXParser, but where and how not to get.

    Help, please

    my error solved

    Compile using - javac - classpath \oracledi.sdk\lib\.; \oracledi.sdk\lib\* SmartImport.java

    Run using - java - Djavax.xml.parsers.SAXParserFactory = oracle.xml.jaxp.JXSAXParserFactory - classpath. / ; \oracledi/client/modules/oracle.xdk_11.1.0/xmlparserv2.jar; \oracledi.sdk\lib\.; \oracledi.sdk\lib\*;. SmartImport ojdbc6.jar

    NOTE: do not change any slash('/'or'\') backward or forward, just replace by your odi_home. provide command line arguments according to the requirement of your class.

    Thank you

    Deepali.

  • I have 12 PS elements and Premier elements installed on Windows 10. How do we install PSE 14 and 14 PE of DVDs so that the Organizer 14 will display photos and videos imported using 12 Organizer? I would also, continue to use PSE12 and EP 12

    I have 12 PS elements and Premier elements installed on Windows 10. How do we install PSE 14 and 14 PE of DVDs so that the Organizer 14 will display photos and videos imported using 12 Organizer? I would also, continue to use PSE12 and EP 12

    When you install a new version of the items, you are prompted to update the current catalog. Creating a new catalog with the data in the old. The new catalog has the same name as before and can be opened in the new version, the old catalog is unchanged, but renamed with a suffix-1 can be opened in the old version without any intervention on your part.

    If you do agree to the conversion prompt, you can do it later from the Catalog Manager; same for the other catalogues.

    Just be careful what you do in a catalog are ignored by the other, they cannot be updated by the other. This means that you will need to choose which version of catalog to choose to manage your files.

    In addition, I don't see a way to use PSE12 catalogs to edit in the PSE14 Editor.

  • Anyone who has a problem with the system crashes when importing using the new interface to import

    Anyone who has a problem with the system crashes when importing using the new interface to import

    Can specify you what Adobe program you use so that we do that your post is in the right forum?

  • Import using eulapi removes such content from EUL

    We use eulapi to automate the import of the EEX files. While he was trying to decide on the best method I've tried a few things out, but I had problems successfully perform an import using eulapi. I did the following command to create the EEX:

    eulapi - connect EUL_US/pwd@dev.
    -export $HOME/Procurement.eex.
    -business_area_and_contents purchases.
    -business_area_and_contents 'accounts payable '.
    -log $HOME/Procurement_exp.log

    and the following to import:

    eulapi - connect EUL_US/pwd@tst.
    -import_rename_mode r - auto_refresh.
    ID-preserve_workbook_owner.
    -Import Procurement.eex.
    -log $HOME/Procurement_imp.log

    The problem I have is that all of the items referenced in the EEX are removed from the EUL when the import is completed rather than be updated. Someone met by this type of problem before? Any help gratefully received.

    Thank you
    NIC

    Hi Rod,

    It turns out that the problem is that we have a mode EUL and EUL_US apps is not a user of apps. In this case the - switch auto_refresh leads to objects being ignored because the import is unable to access the applications objects they are based on. If we run the script without the - auto_refresh pass then import works fine.

    Thank you
    NIC

  • the import using SpeedUp imp tool process

    Hello
    How many ways to import using imp tool speedup process in oracle 9.2.0.8

    There are two articles on the web talking about the same thing.
    http://www.Google.com/search?q=how+to+boost+import+and+export+%2B+Oracle

    HTH
    Aman...

  • Eloqua Contact Import using the APi REST in bulk does not work.

    Hello

    I'm following the 'EloquaBulkApiDocumentation' of importing contacts in Eloqua using bulk REST API. But I get the error message. I have exactly according to the JSON content that mentioned in the books.

    REMAINS first call - /api/bulk/2.0/contacts/imports/

    {

    "name': 'example of importing Docs."

    'fields': {}

    'C_FirstName': '{{Contact.Field (C_FirstName)}}.

    'C_LastName': '{{Contact.Field (C_LastName)}}.

    'C_EmailAddress': '{{Contact.Field (C_EmailAddress)}}.

    },

    "identifierFieldName": "C_EmailAddress",

    'isSyncTriggeredOnImport': 'false. '

    }

    Second call REMAINS for data:

    {

    'element':]

    {

    "FirstName": "Juan."

    'Name': 'Garcia ',.

    'emailAddress': " " [email protected] "" "

    },

    {

    "FirstName": "Tatiana"

    "Name': 'Smirnov."

    'emailAddress': " " [email protected] "" "

    }

    ]

    }

    Third, called for synchronization:

    17. here is my id of the list I got rest first Call.

    {

    'syncedInstanceUri': ' / contacts/import/17 "»

    }

    Concerning

    Chrystel.

    Here are the details of the journal:

    " < response xmlns =" https://secure.P03.Eloqua.com/API/bulk/2.0/syncs/4/logs ">

    < number > 8 < / count >

    < hasMore > false < / hasMore >

    elements <>

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.0870000Z < / converted >

    < message > managed to convert file 2014-06-23 T 22-30 - 22_User27_2f3ed1c87d33418f91205d7daee640b8.json (0 KB) with json converter. < / message >

    information < gravity > < / gravity >

    < statusCode > ELQ-00104 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1370000Z < / converted >

    < message > field (C_FirstName) is a part of the import definition, but not included in the file. < / message >

    < Gravity > warning < / gravity >

    < statusCode > ELQ-00121 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1370000Z < / converted >

    < message > field (C_LastName) is a part of the import definition, but not included in the file. < / message >

    < Gravity > warning < / gravity >

    < statusCode > ELQ-00121 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1370000Z < / converted >

    < message > identifierFieldName (C_EmailAddress) must be contained in the fields, if specified. < / message >

    error < gravity > < / gravity >

    < statusCode > ELQ-00112 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1370000Z < / converted >

    < message > field (element) is not part of the import definition and will be ignored. < / message >

    < Gravity > warning < / gravity >

    < statusCode > ELQ-00111 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1500000Z < / converted >

    < message > there is no fields mapped into the file 2014-06-23 T 22-30 - 22_User27_2f3ed1c87d33418f91205d7daee640b8.csv. < / message >

    error < gravity > < / gravity >

    < statusCode > ELQ-00127 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1500000Z < / converted >

    < message > there was a processing error import. < / message >

    error < gravity > < / gravity >

    < statusCode > ELQ-00107 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < e >

    < number > 0 < / count >

    < converted > 2014-06-23T 22: 31:25.1370000Z < / converted >

    < message > trying to unlock the file 2014-06-23 T 22-30 - 22_User27_2f3ed1c87d33418f91205d7daee640b8.csv on import for user 27 17. File has been unlocked. < / message >

    < Gravity > warning < / gravity >

    < statusCode > ELQ-00110 < / statusCode >

    < syncUri >/synchronization/26 < / syncUri >

    < /e >

    < / object >

    < deadline > 1000 < / limit >

    < offset > 0 < / offset >

    < > 8 totalResults < / totalResults >

    < / answer >

    Hi all

    I fix the problem by changing the demand for DATA service of rest. It should be like this:

    [

    {

    "FirstName": "Martin",

    'Name': 'Joseph',

    "" "emailAddress": "[email protected]"

    },

    {

    "FirstName": "Sophia"

    'Name': 'Selly ',.

    "" "emailAddress": "[email protected]"

    }

    ]

    Concerning

    Chrystel.

  • Several areas secure client csv import file

    Hello

    I need to potentially affect several secure areas for each customer in a csv file for import in British Colombia. I see a column for the secure areas, and I guess I can put a secure customer area. How can I add another box secured to the same customer? Support live chat to BC staff tell me that they cannot do.

    Hey Tiff

    Thanks for recent discussions I've worn your requirements in order to solve this problem

    We can create a tool so that you can use the IMPORT of BC file and add an extra column at the end of the worksheet that lists what zones you want to subscribe to the person in (commas for multiple).

    It will take about 4 hours to create this solution. But this is only happening to a point where WE at ENOUGH DIGITAL can download the data for you.

    So next step would be to create a solution that the customer can access (probably within their administration of BC and perhaps a BC APP) which will allow THEM (the client) to download the CSV file, every time they need to use it. You said quite often.

    It will take about 4 hours

    And we will add a feature where the customer must enter an e-mail address to get the results of the import when it is finished. It would be probably just list everything that has failed.

    However if the importation is large, then the import could run for hours. So what we normally do is to create a service that allows your customer import the CSV file, and once complete (20 seconds) the download starts in the background while you continue on other updates. The customer receives an email with the results once the import is complete...

    It will take about four hours to create a service on the web server that does this. It is optional.

    Let me know what interests you. It will solve your problems.

    I'll you email separately with information on our daily rate.

    Hope that helps

    Brett

  • Update the State of the work using APEX_PLSQL_JOB. UPDATE_JOB_STATUS in the procedure

    Hello

    I have trouble getting my head around the status of the work in APEX_PLSQL_JOB.

    I have a button on a page that presents a work using:
              l_sql := 'BEGIN validation_pkg.run_validations_job(NULL,:P7_APP_ID); END;';  
              l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(p_sql => l_sql,p_status => 'Validation Submitted');
    This creates a job runs my packaged procedure and returns the JOB_ID argument which I store in a table, so I can query its status thereafter.

    The job runs then but I want to update the status of the job as it progresses through the stages of the treatment, it runs. So, I want to call APEX_PLSQL_JOB. UPDATE_JOB_STATUS. This call requires two parameters, the JOB_ID argument and the new STATUS. The manual contains the code example:
    APEX_PLSQL_JOB.UPDATE_JOB_STATUS( P_JOB => :APP_JOB, P_STATUS => 'New Status');
    and says: APP_JOB is a "reserved" component that will automatically "replaced for you at runtime with the number of actual jobs.

    However, when I want to talk: APP_JOB in my code 'create a package body... '. ', as
    apex_plsql_job.update_job_status (P_JOB =>:APP_JOB, P_STATUS => 'Stage 1 Complete'); 
    It returns a "bad bind variable. compilation error 'APP_JOB'

    How can I make to APP_JOB in my procedure packed?

    Thank you very much
    Martin

    Hello

    You must add the p_app_job parameter for example to your validation_pkg.run_validations_job procedure.
    Then present you the work as

    l_sql := 'BEGIN validation_pkg.run_validations_job(NULL, :P7_APP_ID, :APP_JOB); END;';
    l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS(p_sql => l_sql, p_status => 'Validation Submitted');
    

    In the procedure, then use you value of parameter in APEX_PLSQL_JOB. UPDATE_JOB_STATUS call

    APEX_PLSQL_JOB.UPDATE_JOB_STATUS( P_JOB => p_app_job, P_STATUS => 'New Status');
    

    Kind regards
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • CSV import failed

    Hi all

    I am currently working on a project to import that requires to import a huge csv file. The file has 425 columns and will contain 13000 lines. Now I'm under test for this is important and we use the available data import function when we right click. But we noticed that, when the file is too large, the import fails every time... I tried to use the sql * option table loader that creates the control files, but this failed as well. I was wondering if anyone else had this problem before and how this has been resolved in fact. I don't want to start coding java just to make this import... or create a task of talend.

    Thank you very much for your help.

    Kind regards

    Carl

    To generate a script in 2.1, on the last page of the wizard, click the send to the box on the worksheet.

    In 3.0, select the method of load as insert the script.

  • list box given to the .csv file using write on the worksheet File.vi

    Hi, I use the write on the worksheet File.vi to write data multicolumn ListBox to the .csv file. If I do record from Excel, the pop-up window shows as an attachment. And data listbox are too different.  I want the data displayed in the first line not the second row (third photo).

    Thank you for your help.

    Before making your Save As in Excel, change the cell formatting of number. This should avoid the scientific notation conversion before you re-register.

    Or just use Notepad to display the file instead of Excel.

Maybe you are looking for

  • iPhone 7 blanked?

    Last night, I put my iPhone 7 loading and started the 10.0.2 update. When I checked a few minutes later, the screen went totally BLANK. I tried smoking, but the sensor in the home button wasn't working, so I could not force to leave them. It seems th

  • Reset, then problems!

    I'm having a huge problem! My iPhone 5 kept acting on me and kept showing me the research on the place where your network provider is supposed to be, show, I was recommended by the Lady at customer service to clear all data and content and then after

  • Skype always online status

    I have problem my few contacts online, but they are not online. I think that on my opinion because I have 2 accounts and tried to sign with the other account on Android so my another account always online when someone uses Skype on android so his Sky

  • WORK STATION XW 4600: POWER UPGRADE ON HP XW 4600

    My HP WORKSTATION xw 4600 a power 414, I want to know if I can up grade my power to 750 or 600 Thank you

  • Not receive a computer given to nine, but don't know the user name and password

    I got a refurbished computer and I don't know the user name and password. Someone knows what to do? * original title - I received a refurbished computer and I don't know the user name and password. Someone knows what to do? *