Consecutive numbers in PLSQL
Hi all
I want to find the maximum number of 1 consecutive numbers in a string.
For example;
Select "100111011000" double
-It should return 3 (111)
Select "0001101000" double
-It should return 1 (11)
Select "11101111" double
-It should return 4 (1111)
y at - it a simple method to find this translates.
Thank you
Sinan
WITH the DATA (str)
Did YOU (SELECT ' 100111011000' FROM dual
UNION ALL
SELECT "0001101000" DOUBLE
UNION ALL
SELECT '11101111' FROM dual)
SELECT str, MAX (LENGTH (cut)) AS mlen
from (select str, regexp_substr(str,'[1]+',1,level) Cup
FROM THE DATA
CONNECT BY LEVEL<=>=>
AND PRIOR str = str
AND PRIOR sys_guid() IS NOT NULL)
GROUP BY str
/
Returns:
STR | MLEN |
------------ ----------
0001101000 | 2 |
100111011000 | 3 |
11101111 | 4 |
but:
Str must be unique... otherwise you will need a different identifier to the connection.
HTH
Tags: Database
Similar Questions
-
After you rename a folder full of .dng and. MOV files using LR CC, I now have two of each file DNG image with consecutive numbers providing unique names. . MOV files are not affected. Activated with "Bridge" and found it said one is one Mac Application, either in the form of windows. I have Lightroom on Mac and Windows PC with local catalogues which are clouds synchronized (but never on at the same time). Could be the cause of this problem? It is possible that differ from the Mac and Windows version catalogs and their creative together via the Cloud technology synchronization can cause this duplication is obvious when all files are renamed by using a number of automatic sequence?
Yes, my default sort criteria is by file name as my beginning of file names with a reverse date followed by a sequence number. I think at some stage I must have reproduced all the files on the Windows PC and saved with a different range of sequence numbers after the element of date filenames outside of LR. Sometime later I have imported in the Lightroom. When I decided to rename all of them using this naming convention, I discovered the duplication hiding behind different file names. This turns out to be a lesson on the practices of workflow systems.
-
Order a sequence of consecutive numbers
I have a table with the following numbers
620053190
620053191
620053192
620053193
620053194
620054131
620054142
620054143
620054144
620054145
620054146
620054148
620054149
620054151
620054152
I need assign a unique value to the sequence of consecutive numbers. I need to have an output as shown below
620053190 1
620053191 1
620053192 1
620053193 1
620053194 1
620054131 2
620054142 3
620054143 3
620054144 3
620054145 3
620054146 3
620054148 4
620054149 4
620054151 5
620054152 5
Can someone please help?
Thank you
Hello
Here's one way:
WITH got_dif AS
(
SELECT num_col
, num_col - ROW_NUMBER () OVER (ORDER BY num_col) AS dif
FROM table_x
-WHERE - if you need any filtering, it's where he's going
)
SELECT num_col
DENSE_RANK () OVER (ORDER BY dif) AS grp
OF got_dif
ORDER BY num_col
;
-
Is it possible to save files with an automatic consecutive numbering?
I searched the forum and the Internet but cannot find an answer to my problem.
I need Photoshop to save my files with an automatic consecutive numbering.
Here's what I do. I have a lot of image files with several photos and negatives scanned in each image file. I need to individually select each photo or negative to be able to copy / paste into a new file, then by recording each photo/negative pasted into a separate image file.
Now I have automated the process of cut and paste and record also some effects with Actions, but when I come to saving the files that I am always prompted to enter a file name no matter if I record the record as 'Save' or ' save under.
So here's my question: is it possible to make Photoshop save each file automatically with an automatically assigned number? Example: Photo0004.tif of the Photo0003.tif file and the next and so on. So I will not need to manually enter a file name each time?
Save batch is not a solution since all files I opened must be subdivided as 12 new files separate and recorded with different names.
As for the version of Photoshop, I use both CS2, CS5 and could sit with another machine with CS6 if this is what is necessary for the job.
Thanks in advance!
Martin
Problem is solved in the forum script in this thread!
Thanks for all the answers!
Martin
-
Batch rename files that have non-consecutive numbers?
I have a folder with about 100 files of images that carry the non-consecutive numbers. Is there a way to rename them all to add something after the numbers (and before the file type extension) without changing the numbers?
Example: If I select 111019.003.dng and 111019.007.dng, is a way to batch rename the 111019.003_tk.dng and 111019.007_tk.dng?
Of course, simply batch renaming it w / a sequence number would change to 111019.003_tk.dng and 111019.004_tk.dng. That is not good.
I realize the easiest way around this is to name them properly the first time, but I'm not the photographer.
Hope that makes sense and thanks.
Bulk Rename in THE Bridge: -.
-
are consecutively numbered table of contents and headlines
Hello Adobe community.
I have two questions about RoboHelp HTML (RoboHelp 9).
1st issue)
It is possible titles are numbered consecutively as in this example (a lower heading level always has the number on the upper level in front of it.):
- Title ABC
- Headline DEF
2.1 title YES
2.2 title POI
2.2.1 title ZUI
3. the title XYZ
The example is as a numbering system is possible in microsoft word.
And the important thing is that the titles are linked to another in a way that fade "2. Headline DEF"2.1, 2.2, 2.2.1 becomes 1.1, 1.2, 1.2.1.
2nd question)
Is it possible, the table of contents consecutively regardless of the books, pages and bookmarks of numbering?
Example:
- Book 1
1.1 page 1
1.2 page 2
1.2.1 Bookmarked_Headline 1
1.2.2 Bookmarked_Headline 2
1.3 page 3
1.4 Bookmarked_Headline 3
The numbers that are used in the table of contents must be the same as titles on the pages there.
I hope you understand my English and can help me.
Kind regards
Denis
What you use in the topics is a multilevel list. See my site for more information on the use of lists.
They may not apply to the content of the table of contents, and now there's a way around what I know, other than manually numbering the books and topics.
Many people move away from the numbering otherwise than in specialized areas.
See www.grainge.org for creating tips and RoboHelp
-
Hello world
Is there a way to create an ID like this number: 09-0101 and so on?
Where 09 is the year where the user has created the new account and 0001 is the consecutive number.
Thanks in advance!Or you can use max + 1 before INSERT trigger
SELECT TO_CHAR (SYSDATE,'YY')||'-'|| LPAD( TO_NUMBER(NVL(MAX(SUBSTR(id,4)),0))+1,4,'0') INTO :block.id FROM your_table WHERE SUBSTR(id,1,2) = TO_CHAR (SYSDATE,'YY')
-
Count the consecutive numbers in a line
Hi all
I recently discovered that we can use Max (decode () Oracle function to rotate the results in a table. I did this very well. However, rotate a table is only part of the solution that I need. The results of the rotating function to something like this:
What I really need, is something like this:01,02,03,05,06,07,08,09,10,11,12,13,14,16,17,20,21,23,25
I really don't know how to begin to solve this but so far I have the following query:1-17, 20-21,23,25
Thanks for help guys.SELECT DISTINCT MAX(DECODE(wldw.wafernumber,'01', '01')) || MAX(DECODE(wldw.wafernumber,'02', ',02')) || MAX(DECODE(wldw.wafernumber,'03', ',03')) || MAX(DECODE(wldw.wafernumber,'04', ',04')) || MAX(DECODE(wldw.wafernumber,'05', ',05')) || MAX(DECODE(wldw.wafernumber,'06', ',06')) || MAX(DECODE(wldw.wafernumber,'07', ',07')) || MAX(DECODE(wldw.wafernumber,'08', ',08')) || MAX(DECODE(wldw.wafernumber,'09', ',09')) || MAX(DECODE(wldw.wafernumber,'10', ',10')) || MAX(DECODE(wldw.wafernumber,'11', ',11')) || MAX(DECODE(wldw.wafernumber,'12', ',12')) || MAX(DECODE(wldw.wafernumber,'13', ',13')) || MAX(DECODE(wldw.wafernumber,'14', ',14')) || MAX(DECODE(wldw.wafernumber,'15', ',15')) || MAX(DECODE(wldw.wafernumber,'16', ',16')) || MAX(DECODE(wldw.wafernumber,'17', ',17')) || MAX(DECODE(wldw.wafernumber,'18', ',18')) || MAX(DECODE(wldw.wafernumber,'19', ',19')) || MAX(DECODE(wldw.wafernumber,'20', ',20')) || MAX(DECODE(wldw.wafernumber,'21', ',21')) || MAX(DECODE(wldw.wafernumber,'22', ',22')) || MAX(DECODE(wldw.wafernumber,'23', ',23')) || MAX(DECODE(wldw.wafernumber,'24', ',24')) || MAX(DECODE(wldw.wafernumber,'25', ',25')) AS WAFERS FROM a_wiplothistory wl JOIN Container C ON (wl.containerid = c.containerid OR wl.containerid= c.splitfromid ) JOIN a_wiplotdetailshistory wld ON wl.wiplothistoryid = wld.wiplothistoryid JOIN a_wiplotdetailswafershistory wldw ON wld.wiplotdetailshistoryid = wldw.wiplotdetailshistoryid WHERE c.containername = :lot
Published by: 1001275 on May 15, 2013 18:28You can use LISTAGG in your version
SQL> with range_data as 2 ( 3 select min(wafernumber) mn,min(wafernumber)||nullif('-'||max(wafernumber),'-'||min(wafernumber)) txt 4 from 5 ( 6 select wafernumber 7 from wldw 8 order by wafernumber 9 ) 10 group by wafernumber-rownum 11 ) 12 select listagg(txt,',') within group(order by mn) lst 13 from range_data; LST -------------------------------------------------------------------------------- 1-17,20-21,23,25
NB: The sample table of Frank is used...
-
How to compare consecutive groups of numbers in tables
Hello
I need from there to place a table 1 d of the solution.
I need to compare two tables and record the same numbers that are in the two tables, but also save groups of numbers which can be in one of the two compared tables.
In the example l could not put all consecutive numbers 8,9,10,11,12 groups in a 1 d array.
Example l have to filter the zeros and the number four.
The numbers in the two tables are always in descending order however may not be in the order of the array index number. It's 15 = 15 index number
A series of consecutive numbers in this example is a group which increase by a value of 1. For example. 8,9,0,22,23,24 are two consecutive groups of numbers.
Thank you
-
Conversion 'numbers' consecutive beaches
I would like to comment on an algorithm that identifies the strings in a list of "numbers." Any comments will be appreciated.
I have a series of strings indicating the numbers of section like this:
102.2, 102.3, 102.4, 102.5, 102.6, 102.16, 102.17, 102,18, 102.19
What I want to do, it is the collapse of three or more consecutive numbers in the ranges:
102.2 - 102, 6, 102.16 - 102.19
First of all, I convert the string to an array of numbers of sections. Then I get two lists of numbers; one of the hundreds, the other with dozens. Then, I go through these lists, identify the ranges and return a list of positions in the table. Also, in this example, I get:
1
5
6
9
If the length of the positions is less than the table, I know there is at least a beach. Now, I am going through the ranges to understand that members eliminate table. I'm starting at the end of the list of positions and subtract [x] - [x-1]. Then
9 - 6 = 3
6 - 5 = 1
5 - 1 = 4
Any result > 1 is a range. I subtracted 1 from the result and which tells me how many members to eliminate the table. So for the first, I delete two members after the 6, 7 and 8. I jump the other because the result is not greater than 1. The third argument gives me 4-1, so I remove 3 members after position 1 (2, 3, 4). The table ends up with 102,2, 102.6, 102.16 102.19.
Note that the way I have the hyphens in the correct position is not important here. Also, my descriptions of the above posts assume 1 as the first position, not 0 as they are in JavaScript arrays.
Here is my code in JavaScript. Any suggestions for simplification of the algorithm are appreciated. Thank you.
Rick Quatro
var refs = "102.2, 102.3, 102.4, 102.5, 102.6, 102.16, 102.17, 102.18, 102.19"; // Convert the string into an array. var refsArray = refs.split(", "); // Split the numbers into hundreds and tens places. var numbers = getNumberSets (refsArray); // Return a list of positions in the array, indicating ranges. var positions = getRangePositions (numbers); // Delete the unneeded members from the refsArray. removeRedundantMembers (positions, refsArray); alert (refsArray); function removeRedundantMembers (positions, refsArray) { var count = positions.length - 1, span = 0; // Loop from the end of the array to the beginning for (var i = count; i > 0; i -= 1) { // Get the distance between to consecutive positions. span = positions[i] - positions[i-1]; if (span > 1) { // Remove the unneeded members. refsArray.splice(positions[i-1] + 1, span - 1); } } } function getRangePositions (numbers) { // Make an array of positions. var positions = []; // Make variables to store the current hundreds and tens values. var hundred = -99, ten = -99; for (var i = 0, count = numbers.hundreds.length; i < count; i += 1) { if (numbers.hundreds[i] !== hundred) { // hundreds value changed; store this position. positions.push (i); // Update current hundreds and tens values. hundred = numbers.hundreds[i]; ten = numbers.tens[i]; } else { // hundreds stayed the same; check tens place. if (numbers.tens[i] !== (ten + 1)) { // More than one tens places skipped; store this position and the previous. positions.push (i-1); positions.push (i); } ten = numbers.tens[i]; } } // The last position is always needed. positions.push (count-1); return positions; } function getNumberSets (refsArray) { // Make an object of arrays for the number parts. var numbers = {hundreds: [], tens: []}; // Make a regular expression to split each number. var regex = /^(\d+)\.(\d+)$/, match; // Loop through the references and split each one at the dot. for (var i = 0, count = refsArray.length; i < count; i += 1) { if (regex.test (refsArray[i])) { match = regex.exec (refsArray[i]); // Convert the individual strings to integers and add them to the arrays. numbers.hundreds.push (parseInt(match[1], 10)); numbers.tens.push (parseInt(match[2], 10)); } else { // Regex doesn't match, so add zeros to the arrays. numbers.hundreds.push (0); numbers.tens.push (0); } } return numbers; }
I think I got it.
You get in trouble because you can have either a digit after the full stop, or two (or maybe more). The trick, then, not to treat it as a number decimal as a fraction, but as two distinct numbers.
When comparing two numbers, as long as the first number in the first is not the same as the first number in the second set, jumping. Then, count same-prime-number croissants values for the second number. That if this set is greater than 2 long count, issued the first number and the last with a hyphen in between. For all other cases, issue starts just the original number and a comma followed by a space.
In the code:
itemlist = app.selection[0].contents; separated = itemlist.split(', '); for (i=0; i
2) { result += '-'+separated[j-1][0]+'.'+separated[j-1][1]; i = j; } else { result += ', '+separated[i][0]+'.'+separated[i][1]; i++; } } alert (result); -
Two equal consecutive integers
In this vi if 2 consecutive numbers are equal the Boolean value remains true even if it must if turn off then.
If there is a way without using local variables to do this?
After writing each boolean, you must erase it before moving on to the next iteration. This is more easily done with an interior OF the loop containing two iterations.
Here is a quick sketch. See if it works for you.
(I've also simplified the rest of your code, which was extremely complicated. I don't know that it could be further simplified. Note that I used a transparent cluster for LEDs, eliminating all these comparisons)
-
Continuous numbering for table and Figure legends
On the FM band, how configure you graphic captions and table to have a consecutive numbering of the file (chapter) to the file? We do not use a chapnum, just continuous as numbering pages.
Use a label series dedicated to each function as F: for figure and T: for the tables (it's in AutoNumber Format paragraph Format).
Make sure that nothing else uses, or resets, except when it is specifically intended, like the names of paragraph Format as "Figure.1.
If it is a book, the book, and each file, make sure that the Numbering of Document properties for the paragraph
(*) Continue the numbering of the previous paragraph in the bookPut no more than one of the same tag paragraph Autonumbering in an framework anchored (counters don't progress not properly).
-
Add numbers to scanned in PDF format
How to add consecutive numbers on a scanned pdf document? @
Please post on the Adobe forums.
Could you please let me know what you want exactly for. You hear how to add Ben number?
Please visit the below mentioned link and see if it helps:
Acrobat help. Add headers and footers Bates numbering in PDF format
Let me know.
Kind regards
Ana Maria
-
How can I get my LOF to see the chapter numbers and page?
I work in FM 11. My document has a TOC, BATCH, and LOF. My LOF would not be up-to-date, so I created a new one from scratch, but can't seem to get the LOF to display the chapter number in the Figure number and the page number. The format should be TitreFigure X - Y Figure... X Z. Where X is the chapter of the source, there is the number listed in this chapter, and Z is the number of page (Figure 1 - 1 Architecture... 1-5 showing the first figure in Chapter 1 is on page 5 of Chapter 1.)
The reference page for the PRIZE which is correct:
Compared to the reference page for the LOF that shows me only consecutive numbers and a page without the chapter prefix numbers:
I tried to copy the reference to the table of contents or the BATCH page. My LOF looks like this:
You must add the <$chapnum>component in all relevant places you want FM to display the chapter number (see the table of contents for examples). You will also need to change some of your paratags to be included in the automatic numbering (if your content is using this combo of num chapter-figure in your chapter documents).
Also insert the tabs in page reference LOF definitions, but use the code '\t' instead of a tab character so that you know that a tab command was specified. Change the corresponding paratags to include the desired tab stops. (for example for Figure_TitleLOF you should have something like "<$paranum><$paratext>\t \t<$chapnum>-<$pagenum>").
$pagenum>$chapnum>$paratext>$paranum>$chapnum>
-
Number consecutive transformed two return true or flase.12345678, 12346578
Oracle 11 g 2 version.
In the sub sample data column has, b if there are 2 two consecutive numbers are transposed in the B of A column she must return the string "true".
with t as
(
Select '123456789 ', '123476581' double b
Union of all the
Select '123456789 ', '123465789' from dual
Union of all the
Select '332211', '332121' from dual
Union of all the
Select '54321', '54312' from dual
Union of all the
Select '78901', '79801' from dual
)
Select a, b from t
I need output like below.
a and b val
123456789 123476581 FALSE
123456789 123465789 TRUE
332211 332121 TRUE
54321 54312 TRUE
78901 79801 TRUE
65432 63452 FALSE
Thanks in advance.
Published by: raj_tech on July 6, 2012 03:06raj_tech wrote:
HI CHRIS.Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE 11.2.0.1.0 Production."
AMT for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - ProductionThank you
RAJESHGreat, so now you have shown us your version.
How about in response to the answer that you were given and let people know if you have had your answer or if there is still a problem. Which is called communication and feedback, and it is certainly useful things along if you do this.
Maybe you are looking for
-
LabVIEW 2009 NI USB-6225 example
I am awaiting the arrival of my acquisition of data NI USB-6225, and I'm looking for a sample VI in Labview 2009 as a starting point for my own stand-alone application. Any direction to an example would be appreciated... See you soon,. TJL
-
How can I reset my password if I forgot my security question answer?
Dear Sir/SM. I tried to access my account through Windows Live Messenger that I ticked to remember my ID and password. But I can't login my account, I tried to reset my password, but I forgot the answer to the security question. Can you help me?
-
Error - "components Windows Update must be repaired" not able to install updates.
Original title: update windows components need to be repaired. Get the message "update of windows components must be repaired", I don't know how to fix it. I am running Windows XP Professional version 5.1 service pack 3, I also have McAfee anti-virus
-
I playd movies last week and tonight he do not play?
-
Cannot delete message deleted with great attachment
I sent an email with a photo attachment that was too large to send. I tried to delete the message, now it is stuck in limbo. It is said that it sends the message. I tried to remove it by using SHIFT/DELETE. now it is said that some items cannot