split the data on each colon
HelloI have some data in a column in my table, it is stored as 1:2:3. When I have this query with the following query:
SELECT
'SRR_SERVICES '. "" SHR_ID_FROM ".
Of
'SRR_SERVICES '.
The output will be:
SHR_ID_FROM
1:2:3
I have woul like the output to be:
SHR_ID_FROM
1
2
3
How can I achieve this?
For example in 10g using settlers...
SQL> ed
Wrote file afiedt.buf
1 select regexp_substr('1:2:3','[0-9]+',1,level) vals from dual
2* connect by level<=length(regexp_replace('1:2:3','[^:]'))+1
SQL> /
VALS
-----
1
2
3
SQL>
Tags: Database
Similar Questions
-
Windows Media Player 11 Date added function - please stop repeating the date for EACH file.
I have been using Media Player 9, decided to upgrade to Windows Media Player 11, and the only thing I can not stand on Player 11 is how it sorts Date added media files. In Player 9 when I chose the column Date added, the program would list all the files on a given under a SINGLE date. With Windows Media Player 11 it lists EACH file with a date so that instead of see Tuesday, December 14, 2010 once and then listing all of the files under it, I see Tuesday, December 14, 2010 about twenty times. I download podcasts once a week and dump it on my phone, but it's a worry now. Is it possible to stop Windows Media Player 11 to repeat the date again and again and force him to the date that the list only once? Think back to Player 9. Alex
Hi Alex103,
It's design in Windows media player 11 and it is also included in Windows Media player 12.
However, you can uncheck this option, follow the steps below:
a. open windows Media player
b. right-click on one of the sorted column
c. click Choose column
d. uncheck data added
With regard to:
Samhrutha G S - Microsoft technical support.
Visit our Microsoft answers feedback Forum and let us know what you think.
-
Hi all
The Oracle worm: 10 gr 2.
Requriment is from the below query am getting the output as below, _*Query*_ with dates as (select to_date('2005 05', 'YYYY MM') start_date, to_date('2006 07', 'YYYY MM') end_date from dual) select substr(max(sys_connect_by_path(to_char(ADD_MONTHS(start_date, level - 1),'YYYY MM'),',')),2) from dates connect by ADD_MONTHS(start_date,level) <= end_date _*Output*_ 2005 05,2005 06,2005 07,2005 08,2005 09,2005 10,2005 11,2005 12,2006 01,2006 02,2006 03,2006 04,2006 05,2006 06 But is there any way that i can split the output as below _*Expected Output*_ 2005 05, 2005 06, 2005 07, ..... .... ... 2006 05, 2006 06 Iam trying with decode, level and connect by level but the query is wrong hoping am making some logic issues. Can someone help me out to get the desired output. Thanks in advance.
WITH t AS (SELECT '2005 05,2005 06,2005 07,2005 08,2005 09,2005 10,2005 11,2005 12,2006 01,2006 02,2006 03,2006 04,2006 05,2006 06' col FROM DUAL) SELECT LEVEL, LENGTH (REGEXP_REPLACE (col, '[^,]')), LTRIM (REGEXP_SUBSTR (col, '[^,]+', 1, LEVEL), ',') FROM t CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (col, '[^,]')) From your query: SELECT LEVEL, LENGTH (REGEXP_REPLACE (col, '[^,]')), LTRIM (REGEXP_SUBSTR (col, '[^,]+', 1, LEVEL), ',') FROM ( WITH dates AS (SELECT TO_DATE ('2005 05', 'YYYY MM') start_date, TO_DATE ('2006 07', 'YYYY MM') end_date FROM DUAL) SELECT SUBSTR (MAX (SYS_CONNECT_BY_PATH (TO_CHAR (ADD_MONTHS (start_date, LEVEL - 1 ), 'YYYY MM' ), ',' ) ), 2 ) col FROM dates CONNECT BY ADD_MONTHS (start_date, LEVEL) <= end_date) CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (col, '[^,]'))
Published by: user2361373 on Sep 8, 2011 06:36
-
Get the date of each month in the last year
Hi all
I need to find the last date of the month for the year.
Example:
I used to spend the date or such year 2012 or 01-01-2012(DD-MM-YYYY)
SQL query should return the last date of the month as
31/01/2012
28/02/2012
31/03/2012
30/04/2012
.
.
.
.
.
12/31/2012
For more top the requirement that I wrote the SQL code following
select rownum as row_count, case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Jan_month, case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Feb_month, case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as mar_month, case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as apr_month, case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as may_month, case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jun_month, case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jul_month, case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as aug_month, case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as sep_month, case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as oct_month, case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as nov_month, case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as dec_month from dual connect by level <= 12 order by rownum;
Result
Jan_Month Feb_Month Mar_Month Apr_Month may_month jun_month jul_month aug_month sep_month oct_month nov_month dec_month 1 31/01/2014 2 28/02/2014 3 31/03/2014 4 30/04/2014 5 31/05/2014 6 30/06/2014 7 31/07/2014 8 31/08/2014 9 30/09/2014 10 31/10/2014 11 30/11/2014 12 12/31/2012 Except the result:
am result except as single line such as
Jan_Month Feb_Month Mar_Month Apr_Month may_month jun_month jul_month aug_month sep_month oct_month nov_month dec_month 31/01/2012 28/02/2012 31/03/2012 30/04/2012 31/05/2012 30/06/2012 31/07/2012 31/08/2012 30/09/2012 10/31/2012 30/11/2012 12/31/2012 Kindly give me suggestion to archive more high result.
Thanks and greetings
Saami
I agree with Marcus Pivot is the way to go on this subject... But on the other hand you almost solved yourself... it was just a max function for your results:
---------
select max(case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Jan_month, max(case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Feb_month, max(case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as mar_month, max(case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as apr_month, max(case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as may_month, max(case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jun_month, max(case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jul_month, max(case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as aug_month, max(case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as sep_month, max(case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as oct_month, max(case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as nov_month, max(case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as dec_month from dual connect by level <= 12 order by rownum;
AND to avoid hard-coding, you can also modify your query in the form:
select max(case when rownum=1 then last_day(to_date(to_char(rownum),'MM')) end) as Jan_month, max(case when rownum=2 then last_day(to_date(to_char(rownum),'MM')) end) as Feb_month, max(case when rownum=3 then last_day(to_date(to_char(rownum),'MM')) end) as mar_month, max(case when rownum=4 then last_day(to_date(to_char(rownum),'MM')) end) as apr_month, max(case when rownum=5 then last_day(to_date(to_char(rownum),'MM')) end) as may_month, max(case when rownum=6 then last_day(to_date(to_char(rownum),'MM')) end) as jun_month, max(case when rownum=7 then last_day(to_date(to_char(rownum),'MM')) end) as jul_month, max(case when rownum=8 then last_day(to_date(to_char(rownum),'MM')) end) as aug_month, max(case when rownum=9 then last_day(to_date(to_char(rownum),'MM')) end) as sep_month, max(case when rownum=10 then last_day(to_date(to_char(rownum),'MM')) end) as oct_month, max(case when rownum=11 then last_day(to_date(to_char(rownum),'MM')) end) as nov_month, max(case when rownum=12 then last_day(to_date(to_char(rownum),'MM')) end) as dec_month from dual connect by level <= 12 order by rownum;
Easy way: (without login)
SELECT LAST_DAY (TO_DATE (ROWNUM, 'MM')) AS Jan_month, LAST_DAY (TO_DATE (ROWNUM + 1, 'MM')) AS Feb_month, LAST_DAY (TO_DATE (ROWNUM + 2, 'MM')) AS Mar_month, LAST_DAY (TO_DATE (ROWNUM + 3, 'MM')) AS Apr_month, LAST_DAY (TO_DATE (ROWNUM + 4, 'MM')) AS May_month, LAST_DAY (TO_DATE (ROWNUM + 5, 'MM')) AS Jun_month, LAST_DAY (TO_DATE (ROWNUM + 6, 'MM')) AS Jul_month, LAST_DAY (TO_DATE (ROWNUM + 7, 'MM')) AS Aug_month, LAST_DAY (TO_DATE (ROWNUM + 8, 'MM')) AS Sep_month, LAST_DAY (TO_DATE (ROWNUM + 9, 'MM')) AS Oct_month, LAST_DAY (TO_DATE (ROWNUM + 10, 'MM')) AS Nov_month, LAST_DAY (TO_DATE (ROWNUM + 11, 'MM')) AS Dec_month FROM DUAL
See you soon,.
Manik.
-
The data of each virtual machine in the list store
We would like to know where to find Datastore (MON) our VMs and integrate in our weekly report.
Someone has an idea, how we could do that?
Any help would be appreciated!
The data in the report are in the $report variable.
Now it depends on where and in what format, you want your state.
If you want a CSV file, you could do
$report = @() Get-VM | Get-View | % { $row = "" | select Name, Datastore, Path $row.Name = $_.Name $row.Datastore = (Get-View $_.Datastore[0]).Summary.Name $current = Get-View $_.Parent $path = $_.Name do { $parent = $current if($parent.Name -ne "vm"){$path = $parent.Name + "\" + $path} $current = Get-View $current.Parent } while ($current.Parent -ne $null) $row.Path = $path $report += $row } $report | Export-Csv "C:\VM-ds-report.csv" -noTypeInformation
If you want to get a report to HTML format, you can replace the last line to
$report | ConvertTo-Html | Set-Content "c:\VM-ds-report.html"
Note that it comes to the ConvertTo-Html cmdlet in its simplest form, you can use the parameters (- title, - head - body) to improve the output.
There are a number of samples of these two methods in this community to quit smoking.
For outlook HTML for example have a peek at the Script to the list of Annotations.
And there are several scripts for reporting have been entered in the script of last year competition.
Those that you can find in the community Community Sample Code .
I almost forgot, there are very nice scripts Alan Renouf that creates reports in Word format.
Recently, he has even published a script to create a Visio drawing from your infrastructure of VI
Post edited by: LucD
-
Create id, id of the update with the date for each record
Hello
Please give me brief idea or document for this concept:
I need to create id, date, update id, updated for each record inserted or updated in the database (multiple tables).
(1) how the user id can be obtained?
(2) is it better if I use views instead of tables for this?
(3) is it possible for each record?
Please show me the full scenario. a piece of code can also be useful.
Thanks in advance.http://psoug.org/reference/table_trigger.html
Concerning
Biju -
split the data belonging to the same group at two different levels
Hello
I have data in the same group I want to split into two levels.
For example: If the XML is:
< data >
Taxable < Type > < / type >
< value1 > one < / value1 >
b < value2 > < / value2 >
< / data >
< data >
Taxable < Type > < / type >
e < value1 > < / 1 >
f < value2 > < / value2 >
< / data >
< data >
Taxable < Type > < / type >
g < value1 > < / 1 >
h < value2 > < / value2 >
< / data >
< data >
Taxable < Type > < / type >
u < value1 > < / 1 >
v < value2 > < / value2 >
< / data >
< data >
Taxable < Type > < / type >
o < value1 > < / 1 >
< value2 > x < / value2 >
< / data >
The output using the RTF model should be:
Taxable
a and b
e f
g h
Not taxable
u v
l x
I can't change the query to add a group.
Kindly, if anyone can help
Published by: user10606061 on 25/06/2012 01:05
delete a table with 2 columns and two rows. In the second column of row 1
in column 2
table below
PS: your must be within a root element
-
How to extract the data from each row
Hello
I wrote a CQL query with lines 3 records. Is it possible in this query to fetch the first record and last present specific field values.
for example,.
Column: c1, c2, c3
Record1: id1, 2,3, 3.5
Record2: id2, 2.3, 3.6
record Record3: id21, 2.3, 3.7
record Record3: id25, 2.3, 3.9
I need to get the average of three rows of c3 and get the first record id and last record ID.
Output 1: id1 id1, avg (c3) = 3.5
output2: id1, id2, avg (c3) = 3.55
Output3: id1, id21, avg (c3) = 3.6
output4: id2, id25, avg (c3) = 3.733
Please help on above.
Thank you
SriHello
Not quite sure that understand what is the problem that you see.
Here's what I got when I ran the query:
Input data:
C1, c2, c3
ID1, 2,3, 3.5
ID2, 2.3, 3.6
id21, 2.3, 3.7
ID25, 2.3, 3.9
DELAYED26, 2.3, 4.0
ID27, 2.3, 4.1Query:
Select T.firstC1, T.lastC1, S1 T.avgC3
() match_recognize
measures
First (M1. C1) as firstC1,
M2. C1 as lastC1,
AVG (C3) as avgC3
all matches
model (A B? C ? | D + C)
subset m1 m2 = (A, B, C) =(A,D)
define
At as prev (A.c1) is null.
B as (count (*) = 2),
C as (count (*) = 3),
D like ((prev (D.c1) is not null) and (count (*))<>
) tOutput:
firstc1, lastC1, avgC3
ID1, id1, 3.5 - avg only trace
ID1, id2, 3.55 - avg from two records
ID1, id21, 3.6000001 - avg from three recent reviews
Id2, id25, 3.7333336 - avg from three recent reviews
id21, delayed26, 3.8666668 - avg from three recent reviews
ID25, id27, 4.0 - average last three book reviewsThis output confirms with you that mentioned the expected results?
Can you please run this query as it is on the above mentioned input data and check by yourself?
If you don't get the desired result, please paste the input data provided, complete the text of the query and the outputs.Concerning
-
Distribute the data in a column and update new column with data of split
Hi all
I'm working on Oracle 10 g. One of my table of the column stores the data, sampled below.
1722999340KK000200000
1444210829AB1001EX003
1444300000CD0148EX003
1722999340KL 000200000
I want to split the data in the report between the numbers (4; 6; 6; 5), as shown below and store it in different columns (A1 |) A2 | A3 | A4).
1444 | 210829 | AB1001 | EX003
Grateful if someone can give me some advice on how to achieve the same in the SQL database.
See you soon,.
noviceinsert into split_tab (A1,A2,A3,A4) select substr(mycolumn,1,4), substr(mycolumn,5,6), substr(mycolumn,11,6), substr(mycolumn,17) from myoriginaltab;
Max
-
How to reset the data counter without resetting the phone
How to reset the data counter each month so that I can control my data counter with our reset the phone (or) without using factory data reset.
Thanks for the reply much appreciated.
Parameters
Data Manager
Press the lower left key
Reset the data counter
-
Regularly should be applied the date and time
My system has suddenly decided that I need to press F1 before it will continue to start. It also decided that the date is Jan.4th 2004 and I need to reset every day
Hello KenDaviesZO,
How old is the machine?
Like you have to re - insert the date on each startup my imidiate answer would be battery CMOS is dead and must be replaced.
The battery is located on your PC motherboard. It is easy to access on a desktop computer, but more difficult on a laptop. Basically, it's like changing a watch battery; the only difference is that the battery inside your PC is slightly larger, around 1/2 in. or more.
To change the CMOS battery see this link: http://www.computerhope.com/issues/ch000239.htm for PC
http://www.instructables.com/id/Laptop-look-dead-Just-repair-it/ laptop
This forum post is my own opinion and does not necessarily reflect the opinion or the opinion of Microsoft, its employees or other MVPS.
John Barnett MVP: Windows XP Expert associated with: Windows Expert - consumer: www.winuser.co.uk | vistasupport.mvps.org | xphelpandsupport.mvps.org | www.silversurfer-Guide.com
-
Update the date/time of Officejet 4620
Should date/time values always be entered manually when you send a FAX, even if there is a computer connected to the internet over the wireless network?
Hello
I would suggest making sure that the date and time is correct in preferences, who must fill in the date on each fax.
-
Query SQL to split the lines based on the amount
I have the data in the following format in the table.
ORDER_ID PRODUCT_ID QUANTITY
O1 A1 3
I need to write the sql query to divide the data in following format:
ORDER_ID PRODUCT_ID QUANTITY
O1 A1 1
O1 A1 1
O1 A1 1
Query must split the data based on the value in the quantity column.
Thank you
Developer
Hello
create table order_items ( order_id varchar2(2), product_id varchar2(2), quantity number ) ; insert into order_items values ('O1', 'A1', 3) ; -- Recursive Subquery Factoring with item(order_id, product_id, quantity) as ( select order_id, product_id, quantity from order_items union all select order_id, product_id, quantity - 1 from item where quantity > 1 ) select order_id, product_id, 1 quantity from item order by order_id ; drop table order_items purge ; Table ORDER_ITEMS created. 1 row inserted. OR PR QUANTITY -- -- ---------- O1 A1 1 O1 A1 1 O1 A1 1 Table ORDER_ITEMS dropped.
-
How to split the PHONE NUMBER in the column of database?
Hello - how to split the telephone within the same column number?
Existing column PHONE data
3711943
8744723
8487928
3349262
I want to split the data in the same
371-1943
874-4723
etc...
Is this possible? I need to do this only through SQL query not PL/SQL.
SUBSTR (your_col, 1, 3). » -'|| SUBSTR(your_col,4)
-
Why I see my data in the data pane when you use a newly created schema?
I am trying to learn Oracle DB at home. I installed Oracle DB Express 11.2 and Developer SQL 4.0.3. I can connect to the database, the communication between SQL and Oracle DB Express Developer works well.
It is probably a problem with Oracle database, but since I see it in SQL Developer, I'll ask it anyway.
If I log in the HR demo schema (in line with the developer of 2 days) and create a new table called OFFICERS with some fictional characters for the data and populate it with the data through the data for HR pane. AGENTS, I can see in the table of retail Developer SQL tab of the component data. I see the column headings for the columns I've created on the top, then the line numbers for each line that I created and the data in each row.
Now I have created my own personal schema, for example MYNAME and then connected to this schema and tried to repeat the above process. I can create the table with the columns by using the new table Wizard. But once the table exists, and I go to the tab of the Panel data on the detail of the Table, I see nothing. No column header. When I hit the insert a row button in the tab of the component data, I see a marker + 1 appear, but I have nothing to click to enter data as I did with HR. OFFICERS.
Now, if I go to the SQL worksheet for embarrassing MYNAME schema and make some INSERTs, COMMIT and a query, for example
INSERT INTO VALUES OFFICERS ('Captain', 'Smith', 'Samuel');
INSERT INTO VALUES OFFICERS ("Corvette", "Jones", "Robert");
COMMIT WORK;
SELECT * FROM PERSONS;In the query result window, I get:
RANK NAME
-------------------- ----- ------
The Captain Smith Samuel
Lieutenant-Commander Robert JonesBut if I go to the Details tab of the Table to MYNAME. OFFICERS and look at the component data, all I see is two numbers 1 and 2. No column header and no data. Just the number of rows.
Why I see data in the pane the HR data. Table tab detail OFFICERS, but I do not see the headers of column or data in the USERNAME data pane. AGENTS? I can see fine columns in the columns pane, but not data in the data pane.
I looked at all the privileges that I know look, and MYNAME has at least the same privileges as HR. Any thoughts?
Thank you in advance.
Periods are used to separate components of object names so that they are not valid in the names.
for example
Schema.table
table. Column
Schema.table.Column
Package.PROCEDURE
Syntax rules for identifiers are in the http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements008.htm#SQLRF00223 SQL language reference manual
Maybe you are looking for
-
Why the links on my home page not work in Firefox 29
After having downloaded 29 FF, hyperlinks on the home page of my provider don't work. If I try to select them, I get a little window indicating that the browser is not supported. 28 FF worked very well. What has gone wrong?
-
Computers cannot start from my Dreamspark Windows 7 disc.
I have acquired an iso to install Windows 7 from Dreamspark program Dreamspark Premium. However, it looks like a bad iso because when I burn it to a DVD, computers do not start. I put the DVD as the first device during the boot and boot, and I also
-
BlackBerry Smartphones that is the latest OS sofrware? n how to upgrade bold 9780?
I want to know the tht who is da last software OS for bb bold 9780 and how to update my device it?
-
My new messages are sent to the junk e-mail, how do I fix this?
Original title: My IE 10 now only receives new e-mail as spam. How can I fix this? This computer is a series 3 Ivy bridge, 64-bit, 16GB running Win 7. I had no problem with IE10 since installed last May. Yesterday, when I downloaded my email address,
-
BlackBerry Smartphones has not received SMS after upgrade to OS6
Hi, I wish someone could help me on this point, since I called CELCOM several times already, but the problem still there. 3 days ago I just upgraded my 9700 to OS6. Before the upgrade, for SMS, I was 3rd party to use applications: CRUNCHsms, after up