Split an array into chunks
How I write a SQL that divides the table into pieces of 2000 lines per segment?
The query below divides the lines into 8 pieces, but instead of specifying the number of pieces, I want to specify the number of records per segment.
select min(object_id), max(object_id), count(*), nt from ( select object_id, ntile(8) over (order by object_id) nt from all_objects ) group by nt;
So there may be gaps in the OBJECT_ID not meaning don't not all lines are sequential (increment by 1). However, I want to determine the min and the max of object_id by segment and I want each piece to accommodate 2000 lines. So if object has 8000 lines and I specify the piece for 2000, then I'd get 4 rows back telling me the min and the max object by segment id. Help, please!
Hi Rinne,
Try this,
Select count (1) in object;
COUNT (*)
--------
90252
Select min (object_id), max (object_id), count (*), nt
from (select object_id, ntile (ceil(90252/2000)) over (order by object_id) nt object) nt group;
Tags: Database
Similar Questions
-
Combing of the elements of an array into a single string
Hello world
I would like to combine all the elements of an array into a single string. For example, I have a table of 5 elements in the chain
A
B
C
D
E
I want to merge all the elements of a unique string of ABCDE.
I tried to use the 'Worksheet picture String' function but the tabs separating caused me a problem even if I removed the by ' search string and replace.
Thanks in advance for your help.
-
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.
-
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.
-
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;
-
Hello. I have a 57 min mts video I would like to cut in several short videos. simple, no doubt. How can I split this video into sections?
Press F1 and type of subitems.
-
How to split a PDF into smaller files using Acrobat XI
How to split a PDF into smaller files using Acrobat XI?
Hi laforcej
Open the PDF in Acrobat...
Go to tools-> Pages-> extract
Now, select the Page number, you want to extract and save
-
How pass an array into a php url using the flex http service?
How pass an array into a php url using the flex http service?
im making something like this:
http://localhost/flex_php/example_return_xml.php?id= {mylist}
-mylist? TABLE
-If I try to use a text variable it works for example. {myvar.text} where myvar is a text input
Any idea!How can I get using XML?
I tried to push the table in a textinput & sent the text of entry in php, it worked! -
splits the string into documents
Hello
I did a query (see regexp) that split a string into records. The problem with the query is the separate in the subquery. Otherwise, it returns millions of records where I expect less than a thousand.
Meanwhile, I found an other solution (see xmlsequence), but this statement returns the message "ORA-03113: end of file on the communication channel.
Please advice.
regexp:
xmlsequence:SELECT smp.sample_id FROM ( SELECT sa.sample_id, sau.u_box_code, sau.u_box_position FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau WHERE sd.sdg_id = sdu.sdg_id AND sd.sdg_id = sa.sdg_id AND sa.sample_id = sau.sample_id AND sau.u_padded_out = 'F' AND sdu.u_client_type = decode('#Client#','-1',sdu.u_client_type,'#Client#') AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#') AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#') AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#') AND sd.status IN ('V','P','C') ) smp, ( SELECT distinct box_code, regexp_substr(box_pos,'[^,]+',1,level) box_pos FROM ( SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu WHERE pt.plate_template_id = p.plate_template_id AND p.plate_id = pu.plate_id AND pt.name = 'Box96' AND p.status IN ('V','P','C') AND p.description like '%NP=%' AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#') AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#') AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#') AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#') ) connect by level <= length(box_pos) - length(replace(box_pos,',')) + 1 ) box WHERE smp.u_box_code = box.box_code AND smp.u_box_position = box.box_pos
SELECT smp.sample_id FROM ( SELECT sa.sample_id, sau.u_box_code, sau.u_box_position FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau WHERE sd.sdg_id = sdu.sdg_id AND sd.sdg_id = sa.sdg_id AND sa.sample_id = sau.sample_id AND sau.u_padded_out = 'F' AND sdu.u_client_type = decode('#Client#','-1',sdu.u_client_type,'#Client#') AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#') AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#') AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#') AND sd.status IN ('V','P','C') ) smp, ( SELECT box_code, trim(x.column_value.extract('e/text()')) box_pos FROM ( SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu WHERE pt.plate_template_id = p.plate_template_id AND p.plate_id = pu.plate_id AND pt.name = 'Box96' AND p.status IN ('V','P','C') AND p.description like '%NP=%' AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#') AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#') AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#') AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#') ) t, table (xmlsequence(xmltype('<e><e>' || replace(t.box_pos,',','</e><e>')|| '</e></e>').extract('e/e'))) x ) box WHERE smp.u_box_code = box.box_code
Hello
When 'LEVEL '.<= x"="" is="" the="" only="" connect="" by="" condition,="" then="" you="" should="" be="" using="" a="" table="" that="" has="" only="" one="" row,="" like="">=>
You can generate a Table of counters (a result set, in fact) who has all the integers that you need and then join one.
The next thread is an example:
I don't don't want to mark in plsql -
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
-
Can I split a file into two files wma?
On Windows XP using Windows Media Player 11. Is it possible to split my file wma into two smaller files? Thank you.
On Windows XP using Windows Media Player 11. Is it possible to split my file wma into two smaller files? Thank you.
===============================================
The software free "iWisoft Free Video Converter.
can divide a. WMA audio file.(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)iWisoft Free Video Converter
http://www.iWisoft.com/videoconverter/How to use iWisoft Free Video Converter
http://www.iWisoft.com/videoconverter/video-converter-tutorial.phpOr maybe would be Movie Maker
a try.Import your. WMA audio file into movie
Manufacturer and to the timeline, drag it to
audio / music.Read the video/audio by clicking on the
"Play" button under the display screen.You will see the playback indicator
(vertical line), advancing through the
timeline.Click on the button "Pause" to the point
where you want to split and type...
CTRL + L or click the "Split" button to the
at the bottom of the display screen.
(you can also make adjustments to)
Drag the playback indicator)Make splits as much as you want and
remove unwanted in law clips
Click on / delete.Leave the segment that you want to
in the script... and save as follows.To save to a file audio .wma...
Type of... CTRL + P (or go to...) File / save movie file)
to open the wizard movie recording.
Choose... My computer.
Next /.
Enter a name and a location.
Next /.
ICT... "Best quality for my computer.
Next /.
Wait while the file audio .wma is saved.
Finishing...Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.
-
How to split pdf pages into sections for easier viewing on iPad?
Hi all!
I am trying to find a way to divide the pages into a PDF in sections, so that when people download the pdf on their iPads, they can just tap on the section to get the display full screen.
I produce a complex report which contains much information about the individual pages and have received complaints that it is too difficult to pinch and zoom in/out of the various sections, as they are discussed at the meetings.
I heard there is a way to split a pdf file so that a faucet or a double tap on an item it will bring full screen, but I could not find a way to do it. Note: divide the report so that the sections are on separate pages is not an option.
Does anyone know how to do this?
Thanks in advance,
Anna
Hi anna1986,.
You can split the PDF file using Acrobat application (Adobe Acrobat free trial downloadversion |) Acrobat Pro DC), please see this link for help DC Acrobat tutorials | Learn how to use Acrobat DC.
Kind regards
Nicos
-
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));
-
PRE9: How to split a clip into two (or more) videos?
I can't believe that this is so hard to do... But HOW?
Put the CTI (current time marker - the vertical line that moves during playback of the video) where you want the cut. For the excellent work, use the left/right keys to move a frame at a time.
Press [Ctrl + K] or click Split Clip in the monitor window.
Note This creates two 'clips' in the project, but does NOT physically turn your original clip into two separate pieces. You will need external software if you try to physically divide or attach original video files.
See you soon,.
--
Neale
Insanity is hereditary, get you your children
Maybe you are looking for
-
Why my weather widgets have stopped updating my dashboard?
Recently, the weather widgets on my dashboard update is no longer with my current conditions. I think this started to happen after the update of the OS X El Capitan. Does anyone know what is the problem?
-
I am able to implement several personal dictionaries
I realize different addons can be used. But there is a facility to use a custom dictionary How to use the spellchecker of Firefox? It is easy to create and pass the dictionaries other than by using addons.For example can I create my own personal dict
-
Autorun file keeps pop up on the screen
Hello, Windows expert My Autoplay file keeps pop up on the screen. Could someone help me on this problem? My computer is running Win XP Pro. SP3. Thanking you in advance.
-
How do you put something in the programs
How can I put mozilla firefox in programs
-
USB headset connected to PC speech recognition does not work
* Original title: can not make headphones work I installed a software that involves speech recognition. I plugged my USB to the PC headset, but when I tried to use Set Up microphone in the control panel / recognition speech nothing works. I have co