How to manage the pause embedded inside the CSV column line
HelloI'm under pressure to make it work. I've already put this question on the forum of the APEX, but on reflection, I think that it relates more to PL/SQL rather than APEX APEX 4.1 having already utility to manage the Upload of CSV.
If you already read in the forum of the APEX, please ignore.
I'm sorry for that. Thanks for reading.
I need to develop an application that allows the user to upload a CSV file to a table of interface.
The APEX version on my workplace is 4.0.2.
I used the code of
http://dbswh.webhop.NET/HTMLDB/f?p=blog:read:0:article:11000346061523
It all works fine until recently I find
If a column in a CSV file cotain a break line (or line spacing) for example (the tester copy and paste this text which has a line break on a column in a spreadsheet)
It is the first sentence.
It is the second sentence.
It will break the 'it's the second sentence In a new column.
The contents of the CSV read next to Notepad as below
Date of assessment, Date, assessment provider, name of the assessor, Court, first name, middle name, last name, PRN person record, NHI number, assisted defendant Y/N number, is dependent on O/N, Notes, primary of ethnicity, "the ethnic origin other, please specify", gender, currently in treatment O/N, another Substance, Substance of concern 5 specified
22/09/2012, Co name of the provider, Warren Edgley, Wellington, sale, 2545554, dgsdf,, 'is the first sentence.
It's the second sentence. ', Japanese, woman, b.
This is the CSV UTIL code, please help me how can I replace the line break to a space so that the download process is correct.
CREATE OR REPLACE PACKAGE BODY "CSV_UTIL"
AS
--strip the beginning and the end quotes, then replace double quotation with single
FUNCTION de_quote (p_str IN VARCHAR2, p_enc_by IN VARCHAR2)
RETURN VARCHAR2
IS
v_str VARCHAR2(32767) := p_str;
BEGIN
IF (p_enc_by IS NULL)
THEN
RETURN p_str;
ELSE
IF SUBSTR(p_str,-1) = p_enc_by THEN
v_str := SUBSTR(p_str,1,LENGTH(p_str)-1);
END IF;
IF SUBSTR(p_str,1,1) = p_enc_by THEN
v_str := SUBSTR(v_str,2);
END IF;
RETURN REPLACE (v_str,
p_enc_by || p_enc_by,
p_enc_by
);
END IF;
END de_quote;
PROCEDURE parse (p_str IN VARCHAR2, p_enc_by IN VARCHAR2, p_sep IN VARCHAR2)
IS
l_n NUMBER DEFAULT 1;
l_in_quote BOOLEAN DEFAULT FALSE;
l_ch NCHAR (1);
l_len NUMBER DEFAULT NVL (LENGTH (p_str), 0);
BEGIN
IF (l_len = 0)
THEN
RETURN;
END IF;
g_words := g_empty;
g_words (1) := NULL;
FOR i IN 1 .. l_len
LOOP
l_ch := SUBSTR (p_str, i, 1);
IF (l_ch = p_enc_by)
THEN
l_in_quote := NOT l_in_quote;
END IF;
IF (l_ch = p_sep AND NOT l_in_quote)
THEN
l_n := l_n + 1;
g_words (l_n) := NULL;
ELSE
g_words (l_n) := g_words (l_n) || l_ch;
END IF;
END LOOP;
g_words (l_n) := de_quote (g_words (l_n), CHR(10));
g_words (l_n) := de_quote (g_words (l_n), CHR(13));
FOR i IN 1 .. l_n
LOOP
g_words (i) := de_quote (g_words (i), p_enc_by);
END LOOP;
END parse;
/*
Author: Oleg Lihvoinen
Company: DbSWH
Changes:
10.02.2011, There was a miscalculation of the file line last position in case it is the end of file
*/
PROCEDURE upload (p_file_name VARCHAR2, p_collection_name VARCHAR2, p_enc_by IN VARCHAR2, p_sep_by IN VARCHAR2, p_rows NUMBER)
IS
v_blob_data BLOB;
v_clob_data CLOB;
v_clob_len NUMBER;
v_position NUMBER;
v_char NCHAR (1);
c_chunk_len NUMBER := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array vcarray;
v_rows NUMBER := 0;
n_seq NUMBER := 1;
dest_offset NUMBER := 1;
src_offset NUMBER := 1;
amount INTEGER := DBMS_LOB.lobmaxsize;
blob_csid NUMBER := DBMS_LOB.default_csid;
lang_ctx INTEGER := DBMS_LOB.default_lang_ctx;
warning INTEGER;
l_sep VARCHAR2(100) := CASE WHEN p_sep_by = '\t' THEN chr(9) ELSE p_sep_by END;
BEGIN
htmldb_collection.create_or_truncate_collection
(p_collection_name => p_collection_name);
-- Read blob from wwv_flow_files
SELECT blob_content
INTO v_blob_data
FROM wwv_flow_files
WHERE NAME = p_file_name;
v_position := 1;
DBMS_LOB.createtemporary (lob_loc => v_clob_data,
CACHE => TRUE,
dur => DBMS_LOB.SESSION
);
DBMS_LOB.converttoclob (v_clob_data,
v_blob_data,
amount,
dest_offset,
src_offset,
blob_csid,
lang_ctx,
warning
);
v_clob_len := DBMS_LOB.getlength (v_clob_data);
IF v_clob_len = 0 THEN
RETURN;
END IF;
WHILE (v_position <= v_clob_len + 1)
LOOP
v_char := DBMS_LOB.SUBSTR (v_clob_data, c_chunk_len, v_position);
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When the whole line is retrieved and not end of file or end of file
IF v_char = CHR (10) AND v_position < v_clob_len OR v_position = v_clob_len + 1
THEN
parse (p_str => v_line, p_enc_by => p_enc_by, p_sep => l_sep);
v_data_array := g_words;
FOR i IN 1..g_words.count LOOP
IF i <= 50 THEN
v_data_array(i) := g_words(i);
ELSE
exit;
END IF;
END LOOP;
FOR i IN g_words.count + 1..50 LOOP
v_data_array(i) := null;
END LOOP;
v_rows := v_rows + 1;
-- exit if uploaded specified number of rows
IF p_rows IS NOT NULL AND v_rows > p_rows THEN
EXIT;
END IF;
-- Store data to collection
n_seq :=
htmldb_collection.add_member
(p_collection_name => p_collection_name,
p_c001 => v_data_array
(1),
p_c002 => v_data_array
(2),
p_c003 => v_data_array
(3),
p_c004 => v_data_array
(4),
p_c005 => v_data_array
(5),
p_c006 => v_data_array
(6),
p_c007 => v_data_array
(7),
p_c008 => v_data_array
(8),
p_c009 => v_data_array
(9),
p_c010 => v_data_array
(10),
p_c011 => v_data_array
(11),
p_c012 => v_data_array
(12),
p_c013 => v_data_array
(13),
p_c014 => v_data_array
(14),
p_c015 => v_data_array
(15),
p_c016 => v_data_array
(16),
p_c017 => v_data_array
(17),
p_c018 => v_data_array
(18),
p_c019 => v_data_array
(19),
p_c020 => v_data_array
(20),
p_c021 => v_data_array
(21),
p_c022 => v_data_array
(22),
p_c023 => v_data_array
(23),
p_c024 => v_data_array
(24),
p_c025 => v_data_array
(25),
p_c026 => v_data_array
(26),
p_c027 => v_data_array
(27),
p_c028 => v_data_array
(28),
p_c029 => v_data_array
(29),
p_c030 => v_data_array
(30),
p_c031 => v_data_array
(31),
p_c032 => v_data_array
(32),
p_c033 => v_data_array
(33),
p_c034 => v_data_array
(34),
p_c035 => v_data_array
(35),
p_c036 => v_data_array
(36),
p_c037 => v_data_array
(37),
p_c038 => v_data_array
(38),
p_c039 => v_data_array
(39),
p_c040 => v_data_array
(40),
p_c041 => v_data_array
(41),
p_c042 => v_data_array
(42),
p_c043 => v_data_array
(43),
p_c044 => v_data_array
(44),
p_c045 => v_data_array
(45),
p_c046 => v_data_array
(46),
p_c047 => v_data_array
(47),
p_c048 => v_data_array
(48),
p_c049 => v_data_array
(49),
p_c050 => v_data_array
(50)
);
-- Clear the line
v_line := NULL;
END IF;
END LOOP;
END;
END;
In my applications, I save these lines in a table rather than a collection of APEX because the number of columns can contain greater than 50.I want to know how can replace these newline within a column to a space.
If anyone has any ideas, please let me know.
Thank you very much in advance.
Ann
Tags: Database
Similar Questions
-
How to manage the default checkbox (line selector)?
Hello
I have a form where there is a default checkbox and I created a button named CANCELLED to cancel the special line, every time the user wants to cancel a particular line, it checks the check box so that, in the back-end, we took a cancel_flag of the column where it is appropriate to update this column 'Y' for the line selected by the end user.
How can manage us this scenerio for the above context? Please any help will be greatly appreciated.
TIA,
By,.
Murielle.Hello
Create after submit conditional process your button
BEGIN FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP UPDATE your_table SET cancel_flag = 'Y' WHERE your_chk_column = APEX_APPLICATION.G_F01(i); END LOOP; COMMIT; END;
Change 'your_table' and 'your_chk_column' according to your table
BR, Jari -
How to manage the lines multiple region table OFA
Hi gurus,
I'm new to the development of new Pages of the OFA. Please help me how to manage multiple lines in the table region OAF.
My requirement I'm not able to manage multiple lines in my area of Table.
First row in my table area I am selected date_start and date_end when I select the end_date I need I need difference bet ween dates.
My problem is I am able to manage the first Table line but I am not able to manage the table still ranks when I fire that time I first get the rank only.
POS:
14/08/12 07:59:40 1
14/08/12 07:59:40 inside
14/08/12 07:59:40 date difference is 86400000
14/08/12 07:59:40 date difference is 1
14/08/12 07:59:40 date is less than 365
14/08/12 07:59:57 1
14/08/12 07:59:57 inside
14/08/12 07:59:57 date difference is 86400000
14/08/12 07:59:57 date difference is 1
14/08/12 07:59:57 date is less than 365
14/08/12 08:00:13 1
14/08/12-08:00:13 inside
14/08/12 08:00:13 date difference is 86400000
14/08/12 08:00:13 date difference is 1
14/08/12 08:00:13 date is less than 365
My custom logic:
If (DutDetSEndDat".equals (pageContext.getParameter (EVENT_PARAM))) {" "} DateDiff (pageContext, webBean); // Am = XxDutyTravelAMImpl // (XxDutyTravelAMImpl) pageContext.getApplicationModule (webBean); OAViewObject = oaviewobject1 (OAViewObject) am.findViewObject ("XxDutyTravelDuDetEOVO1"); System.out.println("1"); If (oaviewobject1! = null) {} System.out.println ("Inside"); oaviewobject1. Reset(); New line added oaviewobject1. Next(); new line added Line OARow = (OARow) oaviewobject1.getCurrentRow (); Date sDate = (Date) row.getAttribute ("DutdetStartDate"); Date = eDate (Date) row.getAttribute ("DutdetEndDate"); java.util.Date VChangeDateTime = new java.util.Date (sDate.timestampValue () .getTime ()); If (sDate! = null & & eDate! = null) {} long m1 = sDate.timestampValue () .getTime (); long m2 = eDate.timestampValue () .getTime (); long diff = m2 - m1; System.out.println ("difference in date is" + diff); int diffDays = Math.round (diff / (24 * 60 * 60 * 1000)); System.out.println ("difference in date is" + diffDays); If {(diffDays > 365) System.out.println ("Date is greater than 365"); } else {} System.out.println ("Date is less than 365"); } } } } Kind regards
Srinivas
Hi Srini,
To get the event line descriptor that shot please use code below.
If (DutDetSEndDat".equals (pageContext.getParameter (EVENT_PARAM))) {" "}
DateDiff (pageContext, webBean);
Am = XxDutyTravelAMImpl
(XxDutyTravelAMImpl) pageContext.getApplicationModule (webBean);String rowRef = pageContext.getParameter (OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow line = (OARow) am.findRowByRef (rowRef);Date sDate = (Date) row.getAttribute ("DutdetStartDate");
Date = eDate (Date) row.getAttribute ("DutdetEndDate");
java.util.Date VChangeDateTime =
new java.util.Date (sDate.timestampValue () .getTime ());If (sDate! = null & eDate! = null) {}
long m1 = sDate.timestampValue () .getTime ();
long m2 = eDate.timestampValue () .getTime ();long diff = m2 - m1;
System.out.println ("difference in date is" + diff);
int diffDays = Math.round (diff / (24 * 60 * 60 * 1000));
System.out.println ("difference in date is" + diffDays);
If {(diffDays > 365)
System.out.println ("Date is greater than 365");
} else {}
System.out.println ("Date is less than 365");
}
}
}Thank you
Vlaminck
-
I would like to know how to manage the ASN.1 encoding/decoding in LabView?
I would like to know how to manage the ASN.1 encoding/decoding in LabView? Hello J,
in the example given here , it looks like a format simple bytestream...
You must read the byte stream, get the first and the second byte to decode the data type and length and then read & catalogued according to number of bytes. And then read 2 bytes and so on...
Encoding will work the same but in reverse
-
How to manage the tv after hdmi to hdmi connection
I want to connect to my computer windows 7 with tv on my Vizio tv hd tuner. I intend to use the hdmi to hdmi connections. After that I made the connection how to manage the tv without going back to the computer. My TV is in another adjacent room to my computer, sbout 20 ft away. Can I use a wireless mouse to manage the tv? The monitor and tv both appear at the same time? What are other options? Thank you for taking my question and to meet others, I put in the forum. Donnie
I guess that the xbox 360 is a must for my setup. Thanks for your reply, Donnie
-
How to manage the SOAP response
Hello (beginner vCO),
I use the SOAP Plugin and trying to figure out how to manage the here, a host of SOAP response is the log I get the SOAP response
[12:53:43.124 2014-05-09] [I] the settings...
[12:53:43.135 2014-05-09] [I] the available settings:
[12:53:43.136 2014-05-09] [I] + parameter name: "GetRequestStatusResult", value: "< response >
< item >
< ServiceRequestID > SR138917 < / ServiceRequestID >
OS DEPLOYMENT < ServiceRequestStatus > < / ServiceRequestStatus >
< ServiceRequestCreated > 09/05/2014-15:20:25 < / ServiceRequestCreated >
< ServiceRequestCompleted > < / ServiceRequestCompleted >
MA138921 < CurrentActivity > < / CurrentActivity >
OS DEPLOYMENT < CurrentActivityTitle > < / CurrentActivityTitle >
< ActivityStartUTC > 09/05/2014-15:32 < / ActivityStartUTC >
< ActivityEndUTC > < / ActivityEndUTC >
< DurationTotalSeconds > < / DurationTotalSeconds >
< AverageDurationSeconds > < / AverageDurationSeconds >
< SecondsOffAverage > < / SecondsOffAverage >
< EstimatedCompletionUTC > < / EstimatedCompletionUTC >
< / OutputParameters >
< warning > < / warnings >
< exceptions > < / Exceptions >
< / response > '
It will be better to try and parse text or try and use another method with vCO
If you haven't done so already, take a look at the action of com.vmware.libarary.soap.processOutParameters. It is the action that generated the log you have placed in us. It generates an object Properties (key, value pairs) with the value for each setting that results.
In your case, assuming that 'outProps' is the result of the above, you can use:
var getRequestStatusResult = outProps.get ("GetRequestStatusResult");
And to analyze the code XML with E4X as Ilian said.
-
Based on http://forums.Adobe.com/thread/1308132?TSTART=0 I decided to add each question separately:
Hello, I am very interested in buying Lightroom 5.2. I tried the RC that was missing today. Yet, I have several questions that I can't find really good conclusive answers, I'd like to get an answer before buying LR. Please do not write maybe like this or that (assumptions), because I don't want to start my entire workflow and then realize that I have to change all around, please reply, if you know for sure that something works and you are, preferably, using this method too.
Is the big question, where I want to especially a conclusive answer: How to manage the photos Lightroom when using 2 computers, keeping all the changes made on one of them, using the same photos for editing. I'm not going to use DNG. Details: I mainly use my old MacBook Pro, but I wish I could use my PC as it is much better (card: i5 2500K, 16 GB of RAM, SSD, USB3, nVidia GTX 560 TI etc.). I have 2 external HD that I could use, one for backup and one for the actual Photos/changes. I you will probably need to use as my internal HDs are fairly complete and I cannot be the kind of things simply delete or move to one (developer, without loss of music, programs etc.).
On this basis, how do I save all such Photos folder (pictures and retouching and preferably presets too)?
According to me, that it should be possible to work cross-platform without having to create a link to the files each time, or without having to keep export/import of the catalog, keeping the single catalog and the picture library on an external drive that is then switched between systems as needed.
Obvious first requirement is an external drive that is formatted in a way (for example, FAT32) that it can be used on both platforms in read/write mode. Given that, if the catalogue AND folder parent si le catalogue ET le dossier parent images are both set to the same level in a global parent folder, then it should be possible to take advatage of ability of Lightroom to use relative paths instead of absolute paths to detect the images, no matter if the player is named (Mac) or lettering (PC). This is how "export as catalog of ' works, that is, it creates a 'package', alias a parent folder, containing the catalog and a replica of the folder hierarchy to exported along with the catalog images. Take this 'package' to another system (same OS or not) and "it works" even if the drive letter is different or the operating system is different... because the relative path of the image catalogue is always the same.
I have not tested this cross-platform (if I have between various PC systems with letters of different readers) so for me it's still just a theory, but there may be others who have done this successfully.
-
How to put the 2nd column 1st column in excel
Hello
I have a question how to set the 2nd column 1st column in excel. Thank you.
Why the 1 iteration for loops?
Why two Index tables? He's just trying to solve the problem created by the loops For on the original 1 d arrays.
Two of these things create 2D tables which are what complicates things and can be eliminated.
You can take your 2 1 d tables, use build table and right-click to set 'concatenate the inputs.
If you have a 2D array, you can use table remodel to make a 1 column of the table of N line 2D.
-
How to read the two columns of data from the Port series
Hello
I'm reading two columns of data from the serial port.
Example:
52439 52430
52440 52437
52209 52214
51065 51070
52206 52390
I use the serial of Visa service and I can read the first column of data from the serial port, but I can't understand how to read the second column.
I want to both sets of chart data.
I enclose my VI.
Thank you for your help.
The analysis of string function takes a "Format string" on top (with the right button of the function and choose Help, which explains all the entries). In particular, you can say 'Give me two numbers separated by a tab' and the output will be two numbers (whole or floating, depending on the chosen format). In particular, %d\t%d specifies a decimal integer,
, whole decimal. -
Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?
Hello
I suggest you to visit these links and check if it helps:
http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4
http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions
It will be useful.
-
How to display the comments column in Windows Media Player 12?
WMP12 - how to display the comments column?
I want to see the Cooments ColonneB in my WMP ads, but it is not giving me the option.Hello
1. What do you mean exactly by the column comments?
2. are you referring to in Windows Media Player?If you want to change the information contained in the Windows Media Player, you can follow the steps in this article.
http://Windows.Microsoft.com/en-us/Windows7/add-or-edit-media-information-in-Windows-Media-Player
-
How to add the new column in existing table to our desired location?
How to add the new column in existing table to our desired location?
For example, I have to add the new column 'course' before the salary column in the emp table.
I think the best way is to add the column at the end of the table and create a new view with the order of the columns...
Another option...
places the data into a temporary table and recreate the table with the correct order of the columns, and then insert data to the table from the temporary table
Refer
Add column (from table) in the desired position
Example:
CREATE TABLE temp_my_user LIKE)
SELECT * FROM password);
DROP TABLE password;
(Password) CREATE TABLE
userID NUMBER
, first name VARCAHR2 (25)
, middleInitial VARCHAR2 (1)
(, name VARCHAR2 (25));
INSERT INTO password (userID, firstName, lastName)
(SELECT username
first name
lastName
OF temp_my_user);
DROP TABLE temp_user;
-
How to download the Csv file with column headers
Hi all
This is pavan, using Apex version 4.2.3
I am trying to download the csv file I followed this link , and I'm able to download excel with headers, when I try to download with headers of this error "'ORA-01858: a non-digit character was found here where was waiting for a digital" I searched in google but could not find the right solution, "
can anyone help on this please.
Thanks in advance,
Kind regards
Pavan
This article is 6 years old.
You should study the solutions that are available for APEX 4.2: data loader or the 'Excel2Collection' plugin (which also manages the CSV files).
Data Loader
It is a wizard that generates an Assistant for your application.
Excel2Collection
You will use the Excel2Collection (in a single process) to convert the BLOB in a Collection
Then, in a 2nd address), you just do a "INSERT...". SELECT statement. Add ' where seq_id > 1 "for files with a header.
MK
PS - Use the "EXECUTE IMMEDIATE" article is not necessary.
-
How to display the database column value in a component of choice selected?
Hello everyone;
I use Jdeveloper 11.1.1.4 and right now I have the .jspx UI page that includes < af:selectonechoice / > components and according to the requirment I have to fill one of the column in the table in this drop-down list.
can someone tell me how to fill the database column value in this drop-down list. I know I need to create the VO for the same thing, but I'm new to this technology. Then please suggest.
Thanks in advance.,
This will help u
https://blogs.Oracle.com/prajkumar/entry/create_lov_in_adf_application
How to create LOV in ADF 11 g | Techartifact
Oracle Fusion Middleware Technologies: 11G: how to create a list of Values (LOV)?
http://www.baigzeeshan.com/2010/03/creating-lov-in-ADF-application.html
http://husaindalal.blogspot.de/2010/05/How-to-default-lov-with-its-first-value.html
-
How to add the new column in the tabular layout editor in Oracle Forms
Hello
I need to add the new column to a datablock and display the newly added column in the form. What are the steps I need to follow.
1. I chose the new column from the view to the datablock.
2. Add the text element in the layout editor. But this position is not correct. It overlaps with another column. How to add the new column to the layout editor?
Thank you
HCIn the layout editor, you can simply drag the fields so that they do not overlap.
See http://www.youtube.com/watch?v=7emNa7THMLgSandeep Gandhi
Maybe you are looking for
-
sleep 5 sec mode iPhone battery drain
Hey guys,. Thus, as stupid as it sounds, I bought an iPhone 5 s water damaged. I knew what I was getting into until I bought the phone. I learned that the battery was not to keep a charge so I had to replace the battery. However, this has not resolve
-
IO_ERR_BAD_BLOCK when you try to use a SATA to USB HD box
I try to get data out of an old HD SATA. I bought an enclosure for the drive, and it worked ok using a stand-alone utility to clone my new HD. I am also able to Exchange readers and clone to multiple HD when I connect it with windows XP works I see p
-
Start the fault Code error 0x0000012A-Vista
original title: start failure-Vista Failed to start Vista in finals - repair options do not set.now I have an error - "stop: 0x0000012A (0 x 000000000000026, 0 x 000000000001, etc.).»has started as a mistake charging registry\system missing or damage
-
Adding PERC H700 3 drives in PowerEdge R710
Hi all I need to increase the storage on a server running non-critical virtual machines. I currently have 3 x 600GB discs and a VD in raid 5.We will be adding 3 more identical drives, staying in raid 5 to increase storage. I read a few posts about si
-
PhoneGap Desktop and core plugins?
Hello!I made an app to PhoneGap and jquery, a couple of years ago. And it's such a fun job. No hazzle or whatever it is. PhoneGap generator remained far from CLI and used. Haven´t no Phonegap work done since then. I'm back... and boyyyyy I'm confused