ETL - split manually entered data on several lines
Hi people. The question of an experienced Oracle semi programmer...I'm looking for some advice on an elegant solution and/or good performance for a lot of food data our database Oracle (10 g R2).
The source data are entered manually and contains invalid entries. More important, a good percentage of the data contains several purchase order numbers into one field in the source, for example ("123456789, 987654000, 987654003, 987654006, 4008-4010').
In the destination table, I want each of these purchase orders to be its own record.
Any thoughts on a good approach to this? I read a few articles on Asktom.com on the 'pipeline functions', but since it is done on the back-end (client only comes into play until after I confirmed the results), I didn't know if I could derive all the benefits of lines own 'pipes' to a single DML vs coating DML statement in my PL/SQL.
The database "at a distance" from the source is also Oracle 10 g 2, if that matters.
I recently discovered how elegantly I could go the other way - compilation of the string fields to multiple records in a single string concatenated to the destination folder using analytical functions. Could take a PL/SQL process that ran for almost half an hour up to seconds in a single SQL statement. = D
Hoping maybe one of the experts can point me in the right direction here. Thanks in advance for any advice you can offer.
with t1 as (
select '100000,100,103,105-109' str from dual union all
select '200000,200,203,205-209' str from dual
),
t2 as (
select str,
regexp_substr(str,'[^,]+') first_element,
column_value element_number,
regexp_substr(str,'[^,]+',1,column_value) element
from t1,
table(cast(multiset(select level from dual connect by level <= length(regexp_replace(str || ',','[^,]'))) as sys.odciNumberList))
),
t3 as (
select str,
first_element,
element_number,
element,
regexp_substr(element || '-' || element,'[^-]+') start_sub_element,
regexp_substr(element || '-' || element,'[^-]+',1,2) end_sub_element
from t2
)
select str,
case element_number
when 1 then to_number(first_element)
else to_number(first_element) + to_number(start_sub_element) + column_value - 1
end val
from t3,
table(cast(multiset(select level from dual connect by level <= end_sub_element - start_sub_element + 1) as sys.odciNumberList))
/
STR VAL
---------------------- ----------
100000,100,103,105-109 100000
100000,100,103,105-109 100100
100000,100,103,105-109 100103
100000,100,103,105-109 100105
100000,100,103,105-109 100106
100000,100,103,105-109 100107
100000,100,103,105-109 100108
100000,100,103,105-109 100109
200000,200,203,205-209 200000
200000,200,203,205-209 200200
200000,200,203,205-209 200203
STR VAL
---------------------- ----------
200000,200,203,205-209 200205
200000,200,203,205-209 200206
200000,200,203,205-209 200207
200000,200,203,205-209 200208
200000,200,203,205-209 200209
16 rows selected.
SQL>
SY.
Tags: Database
Similar Questions
-
difficult to manually enter data into health
with the last update apple has made it very difficult manually enter data into health app... I'm not talking about sugar in the blood or the weights every day entered manually as my personal info that does not normally change
Launch the health application and then press update medical ID.
For example, on your birthday, tap the box just to the right of the birth Date of edit.
Use the app on your iPhone or iPod touch - Apple Support health
-
Representing data of several lines into one line
Hi all
Please check the query below:
If I run the following query, o/p then comes wise line; as below:select manager_id mg_id, employee_id emp_id, last_name name from employees where manager_id = '100' and DEPARTMENT_ID = '80'
But if I want the o/p as below; That is to say; under Manager # 100, all employees emp_id and name should come in ONE row NOT in several lines:mg_id emp_id name 100 145 Russell 100 146 Partners 100 147 Errazuriz 100 148 Cambrault 100 149 Zlotkey
pls help me sort the above desired o/p.mg_id emp_id name emp_id name emp_id name emp_id name emp_id name 100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 Zlotkey
kindly tell me if there are guidelines of accounting (except 'Plain Text help' on the right side) in this forum. I tried a lot of post above 2 o/p in easy to read format, but could not do so.
Published by: Francis Sep 20, 2009 04:28
Published by: Francis Sep 20, 2009 04:29
-
How to change a photoshop action so I can manually enter data in?
I'm currently editing the Image Processor.jsx and their xml files respective for best results. I would do the same for photoshop actions. Is there a program that would allow to open this type of file so that I can manual type and edit data inside. Hope someone can answer to this...
[Left the lounge general Forum, troubled for a specific product - Mod support forum]
You can do a few interactive steps by turning on step dialog boxes. You can therefore use your judgment to adjust the steps as levels, sharpening, curves, transform, change the text etc. You can improve to buy stocks using some scripts in them.
Xtools has a few scripts to help you change the Actions and convert shares to scripts. Search for XTools X writes that he also wrote a plugin Script that is better than the script non-plug-in Processor.jsx Image Image Processor Pro.jsx
Craft of the Actions Package updated August 10, 2014 conditional measures added to Action Palette tips.
Contains- Action Actions Palette Tips.txt
- Action creating Guidelines.txt
- Action dealing with Image Size.txt
- Strengthened through scripts functions.txt Photoshop action
- CraftedActions.atn sample Action set includes an example of Watermarking action
- Sample Photoshop Actions.txt CraftedActions the value stored in a text file.
- More then a dozen Scripts for actions
-
Split the cell enclosed in several lines using REGEXP_SUBSTR - Performance?
Hello
I have a table that has about 20,000 lines. There is a column called key word which has values like below:
File_id Keyword 1 SMITH; ALLEN; WARD; JONES; BRADY 2 S & P500; TOPIX 3 SMALL; LARGE; MEDIUM I want to display the data like this:
File_id KEYWORD 1 SMITH 1 ALLEN 1 WARD 1 BRADY 2 S & P500 2 TOPIX etc. I use this application and it works:
SELECT STG. FILE_ID, REGEXP_SUBSTR (STG. KEYWORD ' [^;] +', 1, LEVEL) AS A KEYWORD OF STG STG_TABLE
CONNECT REGEXP_SUBSTR (STG. KEYWORD ' [^;] +', 1, LEVEL) IS NOT NULL
But its so slow its unusable.
Is there a faster way to return this output?
Other info:
KEY Word is varchar2 (4000), but rarely more than 100 bytes are used
Oracle 11g 2
Thank you!
Wrong approach, there are too many lines that are generated
Apart from replacing regexp with substr/instr, try the first slot
SELECT
STG. FILE_ID
REGEXP_SUBSTR (STG. KEYWORD ' [^;] +', 1, LEVEL) AS KEYWORD
OF STG STG_TABLE
CONNECT
level<= regexp_count(stg.keyword,';')="" +="">=>
and prior STG. FILE_ID = STG. FILE_ID
and prior sys_guid() is not null
-
Hyperion Financial Reporting: Recover data from several lines of another grid
Hey geniuses,.
Don't know if this is the right place to ask questions on HFR...
I have two grids: welcome and support. I tried to recover data supporting the grid, where there are 10 children report derived from a line of HFR lines. I intended to show all children of 10 lines in the report. I tried ".row grid [X] [X]" to recover data and < < MemberName > > to retrieve the name of the project, but only one line is presented in the main with the first name of line project (grid support) and report data sum of the total 10 rows (grid support).
All good ideas?
Thanks to a bouquet.Instead of the formula line insert a line of text and add the function
>
>
>
.....................................................The problem should be solved
Concerning
Celvin
http://www.orahyplabs.com
-
Divide the data into several lines in the table
Hello
I use apex of Oracle 10 g 3.2.
I have a requirement like this.
I have a table like TableA
Col1 Col2
90 1
91 1:2:3
92 3
I want the data as
Col1 Col2
90 1
91 1
91 2
91 3
92 3
How to do this?
Thank you
Published by: user13305573 on August 3, 2010 20:16with your_data as ( select 90 as col1, '1' as col2 from dual union all select 91, '1:2:3' from dual union all select 92, '3' from dual ) select y.col1, regexp_substr(y.col2, '[^:]+', 1, t1.column_value) as col2 from your_data y, 13 table(cast(multiset(select level from dual connect by level <= length (regexp_replace(y.col2, '[^:]+')) + 1) as sys.OdciNumberList)) t1 14 / COL1 COL2 ------------------ ----- 90 1 91 1 91 2 91 3 92 3 5 rows selected. Elapsed: 00:00:00.05 ME_XE?select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for Linux: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production 5 rows selected. Elapsed: 00:00:00.03 ME_XE?
-
View the information from the related table instead of the ID in several line datablock
Hello
I searched on the web, the forum and the documentation, but I have not found a solution to this problem:
I have two tabs with a relationship of the master / detail of one-to-many. Block detail data shows several lines such that it can be several associations table of mater in the details and I want to display the description of the master data block instead of the field with the ID for each line in the block of retail.
I tried to place an item with the option 'copy value', but then I lose the relationship of master / detail, because that is what forms wih the field id for linking blocks.
Also, I've seen in other posts that I can use a view, but I can't understand how would I update or remove data then.
The only thing that I realized is to the description field in its own datablock in the same tab, a relationship master / detail-detail (or master-detail-master). BTW, I don't think it's beautiful "formulas"programming"and it does too much for my needs."
I guess it must be a trivial thing, but I don't know what to try next. Thanks in advance!
Published by: user10278211 on Sep 17, 2008 20:13AAH, I think now I got your management!
You have 1 Deptno and dname "XYZ" in the master and you want to display:
EmpNo Ename DName 1 User1 XYZ 2 User2 XYZ
-What?
If so:
1 create a new element in the retail block, let's call it DSP_DNAME, set database property to point to 'no '.
2. create a POST-QUERY-Trigger on detail-block with the code: DETAILBLOCKNAME. DSP_DNAME: =: MASTERBLOCKNAME. DNAME;
3. create WHEN-CREATE-RECORD-Trigger with the same code.That's all
-
I checked in the application of the health and read the Apple support page. They show the screen for 10 IOS on an iPhone, but their instructions don't work. There is not a Plus symbol to add data manually. It has only an editing tool that you can touch and only allows you to delete data.
Hi, rmetzker!
To manually enter the data points in the application of health, first go to the display of data on health as shown below.
Then select category to which you want to enter data in (I'll use body measurements for example), then press on what data you enter (measurements > weight). In the upper right corner, it will be a plus + icon for you to manually enter your own data points.
I hope this helps!
-
> Now I'm unlable to select more number of lines that are not a sequence in a single page to copy the data rows and paste somewhere in one fell swoop.
> Is this concept implemented in Windows 7. ?
> Is there a provision (method) to select several lines that are not continuous across the keyboard or the mouse in windows 7?Byagaris,
It depends on what program you are trying to copy and paste into. You are able to select continuous, multiple lines, by using the Ctrl Key and clicking, or by highlighting the desired line. For example, I held the Ctrl key and then, using the mouse, has highlighted several different phrases in the various paragraphs, and could then copy them. This feature is available for several versions of windows.
If you are not able to perform this action then post what happens when you try and what program you try it.
Mike - Engineer Support Microsoft Answers
Visit our Microsoft answers feedback Forum and let us know what you think. -
Help to extract data Clob to a column in a table that has several lines in a table
Help to extract data Clob to a column in a table that has several lines in a table
It works for only the first line
CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';
Grant read, write on DIRECTORY XMLDIR to the public;
() dbms_xslprocessor.clob2file
beef in CLOB,
XMLDIR IN VARCHAR2,
"testfile2.txt" IN VARCHAR2);
DECLARE
buf CLOB.
BEGIN
SELECT H15_DOC
IN buf
OF H15TEST. H15_STAGE
where rownum = 1;
dbms_xslprocessor.clob2file (buf, 'XMLDIR', 'testfile2.txt');
END;
/
-This error code
CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';
Grant read, write on DIRECTORY XMLDIR to the public;
() dbms_xslprocessor.clob2file
XData in CLOB,
XMLDIR IN VARCHAR2,
"testfile2.txt" IN VARCHAR2,
CSID in NUMBER: = 0);
DECLARE
CURSOR xmlmycur IS SELECT H15_DOC
OF H15TEST. H15_STAGE
where rownum = 102140;
l_clob CLOB.
XData CLOB.
BEGIN
DBMS_LOB.CREATETEMPORARY (l_clob, true);
DBMS_LOB.CREATETEMPORARY (xdata, true);
OPEN xmlmycur.
LOOP
SEEK xmlmycur INTO xdata;
dbms_xslprocessor.clob2file (xdata, 'XMLDIR', 'testfile2.txt');
EXIT WHEN xmlmycur % notfound;
END LOOP;
CLOSE Xmlmycur;
END;
/
ORA-21560: 3 argument is null, invalid or out of range
ORA-06512: at "SYS." DBMS_LOB", line 991
ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 324
ORA-06512: at line 15 level
FYI, it seems that the file being created will exceed 5 gig
Yes, it is a known issue with DBMS_XSLPROCESSOR.clob2file with big files.
Here is a slightly modified version of the code that I posted earlier, fixing WRITE_ERROR except:
DECLARE
v_file utl_file.file_type;
-write a unique to clob
procedure write_clob (p_content in clob) is
v_buffer varchar2 (32767).
V_POSITION pls_integer: = 1;
v_amount pls_integer: = 32767;
Start
loop
Start
DBMS_LOB. Read (p_content, v_amount, v_position, v_buffer);
exception
When no_data_found then exit;
end;
UTL_FILE.put_raw (v_file, utl_raw.cast_to_raw (v_buffer), true);
V_POSITION: = v_position + v_amount;
end loop;
end;
BEGIN
-Open the file
v_file: = utl_file.fopen ('TEST_DIR', 'testfile2.txt', 'wb', 32767);
-loops through the lines
for r in)
Select h15_doc
of h15test.h15_stage
)
loop
write_clob (r.h15_doc);
end loop;
UTL_FILE.fclose (v_file);
END;
/
-
Difference of dates with conditions and several lines
Hello, I need to make a difference in the dates (seconds) from several lines of the eve of string comparison. FEA
"I need to complete the following table with time for each difference '"UTR 02XXXXXX"between the failure and return substr (message, 1, 11) I think * UTR 02MCD-1 *.CREATE TABLE evtmsg ( evt_date DATE, message VARCHAR2 (50) ); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:39:05', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 fail'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:39:05', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MAD-1 return'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:39:05', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 return'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:38:50', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02ZPD-1 fail'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:38:50', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MAD-1 fail'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 8:38:38', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 fail'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 5:40:36', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 return'); INSERT INTO evtmsg (evt_date, message) VALUES (TO_DATE ('22/09/2010 5:40:22', 'DD/MM/YYYY HH24:MI:SS'), 'UTR 02MCD-1 fail');
{code}
CREATE TABLE test
(DATE date1,
date2 DATE,
VARCHAR2 (50) MSG
);
{code}
And accurate data, that I need to get and to insert in the test tables are as follows:
{code}
2010-09-22 05:40:22-2010-09-21 05:40:36 UTR 02MCD-1 time of failure = 14 seconds
22/09/2010 08:38:38-21/09/2010 08:39:05 UTR 02MCD-1 time of failure = 27 seconds
22/09/2010 08:38:50-2010-09-21 08:39:05 UTR 02MAD-1 hour of default = 15 seconds
22/09/2010 08:38:50 - UTR 02ZPD-1 time of failure =
22/09/2010 08:39:05 - UTR 02MCD-1 time of failure =
{code}
I'll do this task every morning for the eve and UTR returns always but sometimes for the next day (not usually, but sometimes it happens). I managed to do something like that, but I don't know how to do for multiple lines and get you substr UTR 02XXXXX for each of them.
{code}
DECLARE
date of the value of start_time;
date of finish_time;
elapsed_time number (20);
BEGIN
Select evt_date
in start_time
of evtmsg
"where message like ' % UTR % MAD % % of failure."
Select evt_date
in finish_time
of evtmsg
where message like ' % UTR % MAD % % return ';
elapsed_time: = (finish_time - start_time) * 24 * 60 * 60;
dbms_output.put_line (elapsed_time);
END;
{code}
If I can replace MAD MCD I get several lines and does not work.
Thank you.All you have to do is shared in the first select statement into its separate elements:
SELECT evt_date_fail evt_date_return, id, TO_CHAR(TO_CHAR(evt_date_return, 'SSSSS') - TO_CHAR(evt_date_fail, 'SSSSS') seconds FROM (SELECT evt_date evt_date_fail, LEAD(evt_date) OVER (partition by id ORDER BY id||TO_CHAR(evt_date, 'yyyymmddhh24miss')||CASE status WHEN 'return' THEN 1 ELSE 2 END) evt_date_return, id, status FROM (SELECT evt_date, SUBSTR(message, 1, 11) id, SUBSTR(message, 13) status FROM evtmsg WHERE message LIKE 'UTR%' AND categ = 1 AND TRUNC(evt_date) = TRUNC(SYSDATE - 1))) WHERE status like '%fall%' ORDER BY evt_date_fail
Also, you may need to change the CASE statement in the column that uses the LEAD function to replace the 'return' with its Spanish equivalent
-
Insert several lines with dynamic data
Hello
When I do an insert into a table that has several lines of dynamic information. on
a page, it inserts all rows that are dynamically filled. I want only what he
to insert the lines that I choose the initials on. How can I do? Let's say I
have 5 items that are displayed on a page and I want to insert only original
the first 2 because the last 3 are left blank, how should I do this? I tried
implementation of an if statement that says:
< cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".
Then make the insertion in the table
< cfelse >
< / cfif >
I have this game were also up in a loop that says:
< cfloop index = "help" list = "" #form.listofids # "delimiters =",">"
Here is the code for just the insertion. I also have a code here
Update another table. I got this to work, so I just try to get the insertion
works fine for the moment. I can not use this where the query statement:
Where ItemID = #id # because I'm trying to insert into the table of approval, not
the items table. The table is just updated with some other info. in
a few other input boxes.
< cfloop index = "help" list = "" #form.listofids # "delimiters =",">"
< cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".
< cfquery Datasource = '#application. DataSource #">"
Insert into accreditation (APV_ItemID,
APV_ECID,
Document_Type,
Approval_Initials)
Values (' #Evaluate ("form.) (' ItemID # help # ") #',
' #Evaluate ("form. ("ECID # help #") #',
< cfif isDefined (form '. ') ("Help of # PNR_Doc_Type # ') and
"form. "Help of # PNR_Doc_Type #" NEQ "" > "".
' #Evaluate ("form. ("Help of # PNR_Doc_Type # ') #',
< cfelse >
NULL,
< / cfif >
< cfif isDefined (form '. ') ("Help of # PNR_Approval_Initials # ') and
"form. "Help of # PNR_Approval_Initials #" NEQ "" > "".
' #Evaluate ("form. (Aide de # PNR_Approval_Initials #») #
< cfelse >
Null value
(< / cfif >)
< / cfquery >
< / cfif >
< / cfloop >
On the page display, just a table of dynamic info. Here are the 4
things that I have on this page that needs to be inserted to the database.
< input type = "hidden" name = "' ECID #ItemID #" value = "#ECID #" > "
< input type = "hidden" name = "' ItemID #ItemID #" value = "#ItemID #" > "
< input type = "hidden" name = "" PNR_Doc_Type #ItemID # ' value = "PNR Req" > "
< td align = "center" >
< cfif Approval_Initials is not "" > "".
#Approval_Initials #.
< cfelse >
< select name = "PNR_Approval_Initials #ItemID #" >
< option value = "" > select initials < / option >
< cfloop query = "ShowInitials" >
< Cfif Engineer_Initials EQ 1 >
< option value = "#Initials #" > #Initials # < / option >
< / cfif >
< / cfloop >
< / select >
< / cfif >
< table >
Can someone help me please on just the insertion in the database so that it
will insert on the lines that I chose the initials on and not others? Thank you.
AndyYou almost managed, but I see that you have commented.
(" The help of # PNR_Approval_Initials # ') AND form ["PNR_Approval_Initials # help #" ""] NEQ "" > Do things here
-
Selection of several lines to copy and paste
Recently, I created a form and added the functions to allow our customers to enter their information. On one page, I created several lines just so that customers can type in their notes. I noticed that, if I wanted to copy the notes and paste it in another document, such as word, I am only able to copy one line at a time. In addition, when I type the cursor do not run automatically to the next line when I run out of space that I have to manually type the tab key. Someone knows how to fix this?
-Copy several lines: not possible.
-Jump to the next field when the first is complete: Possible, but requires a script and it works not always great place.
-
Save data in several collections of data control
Hello
In another post (
), I asked how to merge data from several collections and display it in a table. FrankNimphius gave me the right answer. I now have my table with merged data from my control of data collections. But now I have reverse request: the table must allow to insert new lines and to store the data in the model represented by all of these collections.I saw this blog https://blogs.oracle.com/jdevotnharvest/entry/how_to_add_new_adfand it is great, but works with a collectionModel, but the idea is exactly the same thing, just with several collectionModels in a parent one.
The table is not lined with a collectionModel, it is bounded to a list < MyObject > in my managed bean, in order to control the integrated data to create/delete operations from the parent collection do not work.
Another thing is: for me the model is a black box, I don't know anything about the model, I just know the datacontrol.
Thank you!
AAPDL
Hello
If you only have access to the data controls then it has no option to combine the two data sources in a single data control (for example, Pojo). Go with a suggested abstraction managed bean, the option I see is to expose a method in the managed bean that you can use to create a new empty - list entry. This then will be displayed as a blank line in the table after PPR.
The trickiest part is later - when you submit or commit the new line - to manually create new lines in other iterators or update other data sources accordingly (for which you will need to know what information goes on what iterator control or data). If other data controls are not BC of the ADF, and then to persist new lines, you will need to explicitly call the methods exposed on the data controls. So what you basically generate is a managed implementation bean of a two-phase commit. And then there's the case of deletion to consider as well.
Frank
Maybe you are looking for
-
Need to keyboard for my Satellite Pro A10
where would I be able to get a replacement for my satellite pro spa10 keyboard to the United Kingdom [Edited by: admin]
-
R8500: QOS is terrible on this router for $400
So before you get this router I was using a $20 off of eBay refurbished Linksys router E6500 running DD WRT (Yes, you can run it on this router if you know where to find the firmware for this). In any case, the flow was not the greatest, but I never
-
Can you have multiple nested DAQmx writing VI?
Hello everyone. I'm pretty new to Labview and am trying to find the best way to manage several instructions 'if' using a table of clusters and outputing to the various pins on a data acquisition module. Going to work to have a dozen DAQmx live write
-
What do you do when you receive a consistent message on a disk space?
What do you do when you receive a consistent message on a disk space? Moved from the community involvement Center Original title: * E-mail address is removed from the privacy *
-
hard drive read as remote storage
I have server Cisco UCS B200 M2 mounted on local hard disk A03-D300GA2, when the server start the hard throgh read initailization HBA 0 and when install ESXI on the hard disk appears in the remote storage. so anyone can advice - why this and how to f