Split a string of html into multiple lines
I'm trying to convert a string into several lines using REGEX, can someone tell me if this is achievable using expressions regular oracle
WITH qry AS)
SELECT ' < p > < /p > < p > two < /p > < p > 3 < /p > ' Str
OF THE DOUBLE
)
SELECT
-regexp_replace)
-regexp_replace)
regexp_substr (str,
' [^ < (/?) p >]. (*', 1, LEVEL)
(-, '< p >', ")
(-, "< /p >", ")
AB
OF qry
CONNECTION OF LEVEL < = LENGTH (regexp_replace (str, ' [^ < (/?) p >]. * "")) + 1
;
Output current:
1 a < /p > < p > two < /p > < p > 3 < /p >
2 (null)
3 (null)
4 (null)
Expected results:
1 a
2 two
3 three
user2022369 wrote:
You are right that I excluded NULL, 8 rows out put to our example looks correct to me
The result included "two" because its locked up in one of our separators
'
I'm not sure of any character that never appear in str
Thank you
Something like:
WITH qry AS)
SELECT "Hello World
one
a text orhere goes
two
more text herethree ' str
OF the double
)
SELECT THE LEVEL,
REGEXP_SUBSTR)
Str,
'(())? (.*?) (()|$)',
1,
LEVEL,
'I,
4
) ab
OF qry
CONNECT BY LEVEL<>
Str,
'(())? (.*?) (()|$)',
1,
'I '.
)
/
LEVEL AB
---------- --------------------------------------------------
1 Hello World
2 a
3 a header
a text orhere goes
4 two
5 more text here
6 three
6 selected lines.
SQL >
SY.
Tags: Database
Similar Questions
-
Simple question: how to divide the string into multiple lines concatenated?
Hi people,
Maybe it's an easy question.
How to split a string that is concatenated into multiple lines by using the SQL query?
ENTRY:
Delimiter = ', '.select 'AAA,BBB,CC,DDDD' as data from dual
Expected results:
I'm looking for something nice to feature "an opposite to «sys_connect_by_path»»data ------------ AAA BBB CCC DDDD
Thank you
Tomaswith t as (select 'aaaa,,bbbb,cccc,dddd,eeee,ffff' as txt from dual) -- end of sample data select REGEXP_SUBSTR (txt, '[^,]+', 1, level) from t connect by level <= length(regexp_replace(txt,'[^,]*'))+1 REGEXP_SUBSTR(TXT,'[^,]+',1,LE ------------------------------ aaaa bbbb cccc dddd eeee ffff
-
Convert a single column into multiple lines
Hi people,
I have a task to display a single column into multiple lines (for use in LOV)
For Ex:
The column consistes of value such as 98,78,67,68,34,90. -It's a unique column values where none of the values can be ' number that is separated by commas
Then we must view it as
98
78
67
68
34
90
-under the number of lines (no lines can be ' do not number).
Thanks in advanceTry this...
SQL> ed Wrote file afiedt.buf 1 select regexp_substr('98,78,67,68,34,90', '[^,]+',1,level) Value 2 from dual 3* connect by level <= regexp_count('98,78,67,68,34,90',',') + 1 SQL> / VALUE ----------------- 98 78 67 68 34 90 6 rows selected.
Thank you!
-
Several checkboxes in a form into multiple lines
Here's the problem I have. I have a table with a list of products and orders. I need to match products to orders in an orginizational page.
I created a repeat region and a set of product images which uses images of products and id to create a list. This part works just fine and it is part of the submission form. The code looks like this:
<? PHP {? >}
< li > <? PHP echo "" < img src = "... / images /', $row_imageListRS ["imageName"] ', '" width = "172" height = "120" > < br / > "
', $row_imageListRS ["altDescription"];? >
< input type = "checkbox" name = 'imgID' value = "<?" PHP echo $row_imageListRS ['id']? ">" / > < br / >
<? PHP echo $row_imageListRS ['id'];? > < /li >
< input type = "hidden" name = "userID" value = "<?" PHP echo $row_currentUserRS ['userID'];? ">" / >
< input type = "hidden" name = "glryID" value = "<?" PHP echo $row_pageRS ['id'];? ">" / >
< input type = "hidden" name = "MM_insert" value = "form1" / >
<? PHP} while ($row_imageListRS = mysql_fetch_assoc ($imageListRS));? >
(that didn't fit in the box formatting)
It gives me a well-formatted list of all products with a checkbox for each image.
Other information is a user ID and an ID of order that also work very well.
I created a function to insert which should work to populate a database table that has only 3 columns other than the primary ID. The columns are, userID, glryID and imgID. I want to be able to review the order and check a bunch of images of the generated list and then click on the submit button and have a new line generated for each image ID.
The problem I have is that the insert loop isn't looped and I get only the first digit of the information. Here's the code for that:
for ($i = 0, $len = count($_POST['imgID']); $i < $len; $i++) { $insertSQL = sprintf("INSERT INTO glryImages (userID, imgID, glryID) VALUES (%s, %s, %s)", GetSQLValueString($_POST['userID'][$i], "int"), GetSQLValueString($_POST['imgID'][$i], "int"), GetSQLValueString($_POST['glryID'][$i], "int")); mysql_select_db($database_mbtseaDB, $mbtseaDB); $Result1 = mysql_query($insertSQL, $mbtseaDB) or die(mysql_error());
I can't understand why I get only one entry per shipment, and I can't understand why I get only the first digit.
For example, if the user ID is 93 and the ID of the image is 42 and the page id is 12 on line of the resulting table is userID 9 imgID 4 and glryID 1.
I'm sure that the error is in the first line of code for the Insert method. Any help would be appreciated.
I thought I would post the solution because it was a simple thing to overlook. After you set the loop of the boxes I called the original again variable in the insert method. Whatever it took, it was change the line in the middle of the insertion section-
GetSQLValueString ($_POST ['imgID'], "int").
at GerSQLValueString ($imgID, "int").
The crazy is that I made the same mistake before a dozen times. Set a value, and then call the definition instead of the value of the whole...
Thanks to all who watched and didn't see the same thing I don't see. H hope this helps someone else.
-
Adding field values into multiple lines in a dynamic table
Hello!
I have create this form (timesheet) where I have a dynamic array with a variable number of lines (I'm adding instances with a single click of a button).
All rows with a field of totalLinhaRelatorio , it is a time field and I need all of these fields to be added to get a total final.
So, I tried these two lines of script (FormCalc):
var finalTotal = sum (Time2Num (rio parteInferior.atividades.tabelaAtividades.linhaAtividade [*] [*] .totalLinhaRelato, "HH: mm"))
$.formattedValue = Num2Time (finalTotal, "HH: mm")
It doesn´t works as I expected. The field gets properly just the value of the first row.
I tried other combinations, such as linhaAtividade.totalLinhaRelatorio [*] and .totalLinhaRelatorio linhaAtividade [*], but nothing seems to work.
Help, please!
Marcos
You're welcome Marcos!
Yes, it is possible, but I've never used FormCalc to do, preferring to JavaScript. As you use the time functions, it makes sense to stick with FormCalc.
Take a look at the syntax here:
http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000211.html.
Hope that helps,
Niall
-
Single field into multiple lines of cutting
Hi allwith res in the
(select 10 as id, 'history of medic' as the title of double union )
Select 20 as id, 'hospital of oklahoma heart' as the title of double union
Select 30 as id, ' Date/time end " like double title " )
Select disitnct
a.ID, a.title
res a
Output of the above code:
ID TITLE
10 background medic
Heart 20 oklahoma hospital
30 latest End Date/time
Here's my task, I need an output like below.
ID TITLE
10 past
10 medic
10 history
20 oklahoma
heart 20
Hospital 20
30 last
30 end
30 date/time
Thanks in advance.
A simple search can do wonders for you
-
Cutting into multiple lines line values
I have the table with columns like below
Table name: Test
Column name: Col1, col2, col3, col4
Values of column as below
col1 col2 col3 col4
A cod mod ss; AA; DD ff; Gg; AAS; feq
B asd; DFG; as fgh null
Ouput: I'm looking:
col1 col2 col3 col4
A cod ss dd
A mod gg aa
A ff aas
A feq
B asd fgh
B dfg
B as
Can someone help me on this?
But if you insist
with
a trial in
(select 'A' col1, col2 "cod;) MOD','ss; AA; FF' col3, col4 'dd, gg, ASA, feq' Union double all the
Select ' B', ' ASD. DFG; ACEs ', 'Natacha', the double null
)
Select col1,
NULLIF (regexp_substr (NVL(col2,'~'), "[^;]")) +', 1, level),'~ ') col2.
NULLIF (regexp_substr (NVL(col3,'~'), "[^;]")) +', 1, level),'~ ') col3.
NULLIF (regexp_substr (NVL(COL4,'~'), "[^;]")) +', 1, level),'~ ') col4
of the test
connect by level<= greatest(regexp_count(nvl(col2,'~'),';'),regexp_count(nvl(col3,'~'),';'),regexp_count(nvl(col4,'~'),';'))="" +="">=>
and prior col1 = col1
and prior sys_guid() is not null
COL1 COL2 COL3 COL4 A COD SS DD A MOD AA GG A - FF AAS A - - FEQ B ASD FGH - B DFG - - B as - - Concerning
Etbin
-
I implemented the Oracle text search in my database. Now I have this query
Select ctx_thes.syn ('RED', 'MY_THESAURUS') of double;
the output is displayed as
{RED} | {MIXTURE OF RED} | {TABLE RED} | {RED}
and I want to get the words in separate lines, i.e.
Red
Mixture of Red
Red table
Red wine
How to split the string into lines?
SELECT * FROM ( SELECT DISTINCT REGEXP_SUBSTR ('{RED}|{RED BLEND}|{RED TABLE}|{RED WINE}', '({)([A-Z]+ *[A-Z]*)(})', 1, LEVEL, 'i', 2) val FROM DUAL CONNECT BY LEVEL <= REGEXP_COUNT ( '{RED}|{RED BLEND}|{RED TABLE}|{RED WINE}', '|') + 1) WHERE val IS NOT NULL;
-
Oracle regular expressions - splits the string into words for
Hello
Nice day!
My requirement is to split the string into words.
So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.
Please note that I am currently embedded blank and the comma as separator, as shown below.
Select regexp_substr('test)
TO
string in words, "([^, [: blanc:]] +) (', 1, 1) double;"How to integrate the semicolons and line break characters in regular expression Oracle?
Please notify.
Thanks and greetings
Sree
This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:
SQL > select ' testto, mm\;
ERROR:
ORA-01756: city not properly finished chainSQL >
Just break the chain:
SQL > select regexp_substr ('testto, mm\;' |) '
2 string into words
3 \w+',1,level ',') of double
4. connect by level<= regexp_count('testto,mm\;'="" ||="">=>
5 string in words
6 ','\w+')
7.REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
--------------------------------------
Testto
mm
string
in
WordsSQL >
Or modify SQL * more the character of endpoints:
SQL > set sqlterm.
SQL > select regexp_substr ('testto, mm\;)
2 string into words
3 \w+',1,level ',') of double
4. connect by level<=>=>
5 string in words
6 ','\w+')
7.REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
--------------------------------------
Testto
mm
string
in
WordsSQL >
SY.
-
Divide a document into multiple records (lines)
I use ODI to move the data from the source on the target system. Both are Oracle. In the source system, I have a file I need to split into multiple records or lines in the system target according to certain rules. How can I achieve this in ODI. Please explainHello
What a day I understood your example
I have a few questions...
1. you have information about the patient in a table 1 source.
2. How do you identify for patient X you need to create 5 rows. you store this information in the table seprate or how...3. If you have this information in separate tables... a simple cross join in ODI, you should get the result...
Or give additional information with an example... it would be great...
Thank you
-
How to split a string into several substrings parent using a delimiter
Hello
I am forced to split a string into several substrings parent using a delimiter.
And insert these substrings in variuou of the columns of a table in a row.
For example. The sting is: ABC * DEF * GHI * JKH *.
where ' *' is the separator.
Desired output:
Col1 Col2 Col3 Col4 Col5
------- -------- -------- ------- ---------
JKH GHI ABC DEF (null)
Could you please guide me how can I achieve this.
Thank you
Bogoss
Hello Salim,
Leave the thread for reference... got this excerpt:
with t as
(
Select "c: its: hgfd:1:23" Str
)
Select
REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 1, null, 1) col1
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 2, null, 1) col2
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 3, null, 1) col3
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 4, null, 1) col4
, REGEXP_SUBSTR (str, ' ([^:] *)(:|$)', 1, 5, null, 1) col5
t;
This code snippet works well, but for the fixed columns. Here are 5 predefined columns.
But I need to have a logic that I can browse the string any No.. sometimes.
For example. If I get 3 secondary channels of the parent chain... I need to insert into 3 columns.
And if I get 6 strings under... I need to insert into 6 columns.
Could you please help me develop a logic like that.
I use Oracle database 10g.
And the data are currently being collected on external table... but I can store in a variable or a column of a database table.
Thank you
Bogoss
-
splits the string into 3 parts
Hello
I have a requirement to split the string into 3 different room example inf.ethz.ch should be subdivided into inf ethz ch in 3 different column
We have table called email within this column contains all identification of email we need to divide email with dot (.) in different columns and display please suggest how to implement in the query
Thank you
Sudhir
Use REGEXP_SUBSTR:
SQL > with t as (select ' inf.ethz.ch' double txt)
2 Select regexp_substr (txt,'[^.] +') part_1,.
3 regexp_substr (txt,'[^.] +', 1, 2) part_2,.
4 regexp_substr (txt,'[^.] +' 1, 3) part_3
5 t
6.BY PARTY PA
--- ---- --
INF ethz chSQL >
Or you can use SUBSTR + Instr.
SY.
-
Combine multiple lines into one line (from two tables / result sets)
Hello experts,
I would like to know how to combine multiple lines/records in a single record. Here are the DDL and DML to tables:
create table test_table)
client_name varchar2 (50 char),
login_time timestamp (6).
logout_time timestamp (6).
auto_type varchar2 (10 char)
)
create table root_table)
navigation_time timestamp (6).
client_name varchar2 (50 char),
VARCHAR2 (50 char) nom_du_groupe
)
Insert into test_table
values ("John", TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');
Insert into test_table
values ('David', TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.) FF'), 'SIMPLE');
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:04:01.512 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "invalid");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:14:22.333 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 17:27:31.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'John', "GROUP_1");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 06:33:01.308 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), "David", "invalid");
insert into root_table
values (TO_TIMESTAMP ('2013-12-05 06:45:01.112 ',' YYYY-MM-DD HH24:MI:SS.)) FF'), 'David', 'GROUP_5');
game results test_table
client_name login_time logout_time auto_type John 05/12/2013 5:04:01.512000 PM 05/12/2013 5:27:31.308000 PM SIMPLE David 05/12/2013 6:33:01.308000 AM 05/12/2013 6:45:01.112000 AM SIMPLE root_table result set
navigation_time client_name GroupName 05/12/2013 5:04:01.512000 PM John Not valid 05/12/2013 5:14:22.333000 PM John GROUP_1 05/12/2013 5:27:31.308000 PM John GROUP_1 05/12/2013 6:33:01.308000 AM David Not valid 05/12/2013 6:45:01.112000 AM David GROUP_5 And here is the SQL code I'm writing:
Select a.customer_name, a.login_time, a.logout_time, a.auto_type, Max (b.group_name)
from test_table a, b root_table
where a.customer_name = b.customer_name
Group of a.customer_name, a.login_time, a.logout_time, a.auto_type
As the 'invalid' value is greater than the value "GROUP_1" (based on the number of letter in English), the GroupName is returned as 'invalid '. I want to bring the GroupName based on the navigation_time column in the root_table so that it always returns a valid GroupName. Please help me.
Output current:
Client_name. Login_Time. Logout_Time | Auto_Type | GroupName
--------------------------------------------------------------------------------------------------------------------------------------------
John | 05/12/2013 5:04:01.512000 PM | 05/12/2013 5:27:31.308000 PM | SIMPLE | Not valid
David | 05/12/2013 6:33:01.308000 AM | 05/12/2013 6:45:01.112000 AM | SIMPLE | Not valid
Expected results:
Client_name. Login_Time. Logout_Time | Auto_Type | GroupName
--------------------------------------------------------------------------------------------------------------------------------------------
John | 05/12/2013 5:04:01.512000 PM | 05/12/2013 5:27:31.308000 PM | SIMPLE | GROUP_1
David | 05/12/2013 6:33:01.308000 AM | 05/12/2013 6:45:01.112000 AM | SIMPLE | GROUP_5
Thank you!
Adding INSERT statements, current and planned outputs.
This...
SELECT client_name
login_time,
logout_time,
auto_type,
GroupName
Of
(select a.customer_name,
a.login_time,
a.logout_time,
a.auto_type,
b.group_name,
ROW_NUMBER() over (PARTITION BY a.customer_name, a.login_time, a.logout_time, a.auto_type ORDER BY b.group_name) rn
from test_table a, b root_table
where a.customer_name = b.customer_name)
WHERE rn = 1;
OUTPUT:-
=========
David DECEMBER 5, 13 06.33.01.308000000 AM DECEMBER 5, 13 06.45.01.112000000 AM SIMPLE GROUP_5 John DECEMBER 5, 13 05.04.01.512000000 PM DECEMBER 5, 13 05.27.31.308000000 PM SIMPLE GROUP_1 Thank you
Ann
-
How to split a string into columns
Hi all
Have a strings like this, where the delimiter is
Thanks in advance10:00 | x1 | 2 | RO | P | Con ausilio | y1 10:10 | x2 | 1 | RO | | | y2 10:20 |x3 | 3 | | | | y3 10:30 |x4 | 3 | RO | N | Con aiuto | y4 10:40 |x5 | 1 | RO | | | y5 how can I break it up into columns, for example, the first char(before first pipe) insert in first variable, then, after first pipe, second characters in a other column ans so on col1 := '10:00'; col2 := 'x1'; col3 := '2'; col4:= 'RO'; col5 := 'P'; col6 := ' Con ausilio '; col7 := 'y1'; col1 := '10:10'; col2 := 'x2'; .. and so on
Hello
If you want to split the string str into 7 columns :
SELECT TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1)) AS col1 , TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2)) AS col2 , TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3)) AS col3 ... , TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7)) AS col7 FROM table_x ;
If you want to split it inot 7 variables :
col1 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 1)); col2 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 2)); col3 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 3)); ... col7 := TRIM (BOTH FROM REGEXP_SUBSTR (str, '[^|]+', 1, 7));
-
split a string into pl/sql
Hello
How to split a string and store in an associative array in pl/sql.function
My string like this
'1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001'
and assign it to the array list. According to
can someone please help
concerning
rYou can try the following. Although I recommend, it would be better to write the function code php as a java stored procedure parser and use the result. We have a class defined in Java String Tokenizer.
-- Define function to split string into tokens FUNCTION get_token( p_input_string IN VARCHAR2, -- input string p_token_number IN PLS_INTEGER, -- token number p_delimiter IN VARCHAR2 DEFAULT ',' -- separator character ) RETURN VARCHAR2 IS v_temp_string VARCHAR2(32767) := p_delimiter || p_input_string ; v_pos1 PLS_INTEGER ; v_pos2 PLS_INTEGER ; BEGIN v_pos1 := INSTR( v_temp_string, p_delimiter, 1, p_token_number ) ; IF v_pos1 > 0 THEN v_pos2 := INSTR( v_temp_string, p_delimiter, 1, p_token_number + 1) ; IF v_pos2 = 0 THEN v_pos2 := LENGTH( v_temp_string ) + 1 ; END IF ; RETURN( SUBSTR( v_temp_string, v_pos1+1, v_pos2 - v_pos1-1 ) ) ; ELSE RETURN NULL ; END IF ; EXCEPTION WHEN OTHERS THEN RAISE; END get_token; -- Call the above function in loop for a string with N tokens DECLARE TYPE assoc_arr_str_typ IS TABLE OF VARCHAR2(100) INDEX BY PLS_INTEGER; str_arr assoc_arr_str_typ; v_str VARCHAR2(200) := '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001' ; v_token VARCHAR2(4) ; i PLS_INTEGER := 1 ; BEGIN LOOP v_token := get_token( v_str, i , ',') ; EXIT WHEN v_token IS NULL ; dbms_output.put_line( v_token ) ; str_arr(i) := v_token; i := i + 1 ; END LOOP ; END ; /
Published by: GG 24 March 2011 09:51
Maybe you are looking for
-
Satellite T130 - Win 7 driver for a new Bluray disk
Hello I just bought a disc drive BD - MLT UJ - 220 Panasonic/First Com USB with the ability to read and write Blu - Ray hi def format. However, I seem to be unable to get their hands on the drivers of Toshiba for Windows 7 (I've got Toshiba Satellite
-
Hi all What is the maximum size of the ssd model T420 support. Thank you
-
Great picture 'In Place Struct' or 'replace the item.
Hi community I have a basic question about performance and memory allocation. In the past we sometimeise dealed with corresponding "memory full error" massage and a labview crash. These are generally produce on relativley applications of long duratio
-
Compensate for the gradient tool
Hi guysI use PsCC2015 I drew an ellipse and has added a gradient, with a radial pattern. The center of the star is at the center of the ellipse. For the effect I want, I need to compensate for the radial gradient from the center of the ellipse Center
-
A local application can be started and used on a page of Web site by the local user
can we build a way for a user to a Web site to open a desktop application on the local computer and run it through a page window. Just curious... Thank you