Consolidation of all combinations of subgroup
Hello Experts,
I have a table that contains the list of user code and group. I would like to form groups if users have the same group code. Here are examples of data.
Given for entry
User code | Group code |
ANGAL | FM_AGFARE1 |
TAND | FM_AGFARE1 |
CHANH | FM_AGFARE1 |
ANGAL | FM_AHOBIU2 |
TAND | FM_AHOBIU2 |
CHANH | FM_AHOBIU2 |
ANGAL | FM_AMDVPS2 |
TAND | FM_AMDVPS2 |
CHANH | FM_AMDVPS2 |
ANGAL | FM_ASPGOT1 |
TAND | FM_ASPGOT1 |
ANGAL | FM_ASPM1 |
CHANH | FM_ASPM1 |
Output should be like ANGAL users, TAND and CHANH group code common 'FM_AHOBIU2', 'FM_AGFARE1', 'FM_AMDVPS2', they should be grouped in Group 1.
but only ANGAL TAND belongs to FM_ASPGOT1 group code, so they should be grouped in Group 2 and so on.
User code | Group code | Groups |
ANGAL | FM_AGFARE1 | Group 1 |
TAND | FM_AGFARE1 | Group 1 |
CHANH | FM_AGFARE1 | Group 1 |
ANGAL | FM_AHOBIU2 | Group 1 |
TAND | FM_AHOBIU2 | Group 1 |
CHANH | FM_AHOBIU2 | Group 1 |
ANGAL | FM_AMDVPS2 | Group 1 |
TAND | FM_AMDVPS2 | Group 1 |
CHANH | FM_AMDVPS2 | Group 1 |
ANGAL | FM_ASPGOT1 | Group 2 |
TAND | FM_ASPGOT1 | Group 2 |
ANGAL | FM_ASPM1 | Group 3 |
CHANH | FM_ASPM1 | Group 3 |
Please help me with above request.
Thank you.
with
groups such as
(select 'ANGAL' user_code, 'FM_AGFARE1' group_code of all the double union)
Select "TAND", 'FM_AGFARE1' from dual union all
Select "CHANH", 'FM_AGFARE1' from dual union all
Select 'TAX', 'FM_AHOBIU2' from dual union all
Select "TAND", 'FM_AHOBIU2' from dual union all
Select "CHANH", 'FM_AHOBIU2' from dual union all
Select 'TAX', 'FM_AMDVPS2' from dual union all
Select "TAND", 'FM_AMDVPS2' from dual union all
Select "CHANH", 'FM_AMDVPS2' from dual union all
Select 'TAX', 'FM_ASPGOT1' from dual union all
Select "TAND", 'FM_ASPGOT1' from dual union all
Select 'TAX', 'FM_ASPM1' from dual union all
Select "CHANH", 'FM_ASPM1' from dual
),
new_groups as
(select group_code,
DENSE_RANK() on dr (order by listagg (user_code, ',') within the Group (order of user_code))
groups
Group_code group
)
Select g.user_code, 'Group'. TO_CHAR (n.Dr) new_group
groups g,.
new_groups n
where g.group_code = n.group_code
USER_CODE | NEW_GROUP |
---|---|
ANGAL | Group2 |
TAND | Group2 |
CHANH | Group2 |
ANGAL | Group2 |
TAND | Group2 |
CHANH | Group2 |
ANGAL | Group2 |
TAND | Group2 |
CHANH | Group2 |
ANGAL | Group 3 |
TAND | Group 3 |
ANGAL | Group1 |
CHANH | Group1 |
Concerning
Etbin
Tags: Database
Similar Questions
-
Create all combinations of rows in a Table
Hi all
Let's say I have a table with the following data.
Category A
Category B
Category C
I want to insert all the possible combinations of these 3 rows in another table.
For example
Category group
Class 10A
20 category B
Category 30 C
Category 40 A
Category 40 B
Category 50 A
Category 50 C
Category 60 B
Category 60 C
Category 70A
Category 70 B
Class 70 C
Any thoughts on how to implement this in Oracle 9i?
Thanks in advance.Hello
I hope this link will help
[http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:5487498576505] -
The best way to generate all possible combinations of 5 digits
Hi Experts,
I'm on Oracle 11.2.0.2 on Linux. I have a task to generate all possible combinations of five digits (1 to 5) and each number can be used only once. I wrote the code below, but I wonder if this is optimal - or if it can be improved on. I will be grateful for your commens on this subject:
DECLARE BEGIN FOR i IN 1 .. 5 LOOP FOR j IN 1 .. 5 LOOP IF i = j THEN CONTINUE; ELSE NULL; END IF; FOR k IN 1 .. 5 LOOP IF (j = k OR i = k) THEN CONTINUE; ELSE NULL; END IF; FOR l IN 1 .. 5 LOOP IF (k = l OR i = l OR j = l) THEN CONTINUE; ELSE NULL; END IF; FOR m IN 1 .. 5 LOOP IF (l = m OR i = m OR j = m OR k = m) THEN CONTINUE; ELSE NULL; END IF; DBMS_OUTPUT.put_line ( i || ' ' || j || ' ' || k || ' ' || l || ' ' || m); END LOOP; END LOOP; END LOOP; END LOOP; END LOOP; END; /
Thnaks,
OrauserN
Hello
orausern wrote:
Hi Frank
Wow! It's all just awesome.
Can you please elaborate more and explain this code? I mean that I do not understand how this sql. You can exaplain in detail how it works?
Thanks again!
OrauserN
What, precisely, do you understand? I guess it's CONNECT BY, I used twice.
CONNECT is a feature that allows for recursion in SQL. It includes an optional to BEGIN WITH and a clause CONNECT BY, which are both similar in a WHERE or HAVING clause conditions. Which respect the terms of the START WITH clause are supposed to be at the level of the line = 1. When it does not START WITH paragraph, all lines are LEVEL = 1. (This is the case in two of my CONNECT garages). A line is on LEVEL = N (N.1) if he meets the conditions CONNECT BY, when you look at some PREVIOUSLY already selected line in this query at level N-1 =. It is often useful to consider the lines forming a graph oriented; the SYS_CONNECT_BY_PATH function returns a string that represents how we traveled through this graph to get each line of output.
As used in the subquery called universe, START WITH is particularly difficult to understand. For now, do not try to understand; just accept that it is a quick and convenient to generate a set of results with 5 rows, numbered from 1 to 5. Let us look at the CONNECT BY the main query instead. This query is very similar to this one, using the scott.dept table:
SELECT path SYS_CONNECT_BY_PATH (deptno, ',')
deptno
LEVEL
OF scott.dept
DeptNo CONNECT BY NOCYCLE <> deptno PRIOR
;
Output:
DEPTNO LEVEL PATH
-------------------- ---------- ----------
, 10 10 1
, 10, 20 20 2
10, 20, 30 30 3
10, 20, 30, 40 40 4
10, 20, 40 40 3
10, 20, 40, 30 30 4
, 10, 30 30 2
10, 30, 20 20 3
10, 20, 30, 40 40 4
10, 30, 40 40 3
10, 30, 40, 20 20 4
, 10, 40 40 2
10, 40, 20 20 3
10, 40, 20, 30 30 4
10, 40, 30 30 3
10, 30, 40 and 20-20-4
, 20 20 1
, 20, 10 10 2
20, 10, 30 30 3
...40, 30, 20 20 3
4 10 10, 20, 30, 4064 selected lines.
As you can see, the above query shows all possible combinations of the 4 values distinct deptno. The query starts by taking a line (in this case, the line with deptno = 10, I'll just say 10 in the future) and the place level = 1. Then he sees what lines are connected to 10 (as defined by the CONNECT BY clause) and places them on LEVEL = 2. All lines except 10 itself are connected to 10 of this affection. Such a line is 20. The lines are connected to 20? Again, all the lines except 20 himself. (10 <> 20, so if you think 10 would seem still level = 3, but it is not.) By default, CONNECT BY will raise an error if a line is connected to itself, directly or indirectly, as in the path ", 10, 20, 10'.» The NOCYCLE keyword tells Oracle to ignore these connections rather than trigger an error).
If there is a WHERE clause, it is applied after the CONNECT BY is completed. In your problem, we did not all combinations, we wanted only the combinations that included all 5 lines, so I used a WHERE clause to display only lines that went up to the LEVEL of output = 5.
For an introduction to CONNECT BY, see
START BY and CONNECT in Oracle SQL
or
-
Operation range (get all possible combinations of characters)
Hello
Example: the string '1,2,4'
Output:
1, 2
1, 4
2, 4
1,2,4
Looking for a simple way.
Thank you.Hello
Here's one way:
First, splits the string into a separate line for each item.
Then use CONNECT BY and SYS_CONNECT_BY_PATH for all combinations of lines.WITH separate_rows AS ( SELECT REGEXP_SUBSTR ( txt , '[^,]+' , 1 , LEVEL ) AS item FROM ( SELECT '1,2,4' AS txt FROM dual ) CONNECT BY LEVEL <= 1 +REGEXP_COUNT ( txt , ',' ) ) SELECT SUBSTR ( SYS_CONNECT_BY_PATH (item, ',') , 2 ) AS combination FROM separate_rows WHERE LEVEL > 1 CONNECT BY item > PRIOR item ;
REGEXP_COUNT was new in Oracle 11.1. In earlier versions, find the number of commas in txt by seeing how the LENGTH decreases when you delete them.
-
What happened to the consolidated Inbox?
Before last update yesterday, I had a 'consolidated' Inbox - all messages from multiple e-mail accounts came together. The update that killed him.
Update is also incompatible with the add-on "Conversations".
Re: an Inbox "consolidated" - all messages from multiple e-mail accounts came together
Do you mean that you have multiple accounts may POP each have been set up as an account of global Inbox using the local folders Inbox, so that any email account appear in the folders pane, only local files?
But now all e-mail POP accounts show with their own Inbox.OR
Do you mean that you used a "unified", view where various POP or imap folders are grouped?
Try:
'View' > 'Files' > 'unified '.
or
'Icon menu' > 'Files' > 'unified '. -
Hi all, I'll try to find out the distance between all points in a chart. I was able to get all possible combinations, but I do not get the expected output.
For example, if I have four points, the total number combinations will be 6 and I want to find the distance in all combinations of six.
Please help me where I have error. Please find the attached vi.
Try something like that.
Because I don't have the function IMAQ, I use complex data for each point, but it would be trivial to adapt it to your data instead structures.
-
Envy 17 - purchased 12 of them and all the gel and BSOD
We bought 12 Envy 17 (model 17-1011NR) from Newegg, and have suffered from blue screens and freezes.
After evaluating the windows dump files, it seems that the USB hub is the root of the problem.
Sometimes the machines blue screen, blocking completely and sometimes crashes just the mouse, which requires a reboot to solve.
Base that was provided by HP image has the same problem.
* After updated all drivers for the newer versions, there always the same results.
Reinstalling the OS (do not use OEM installation) has the same results.
* We tried 6 different models of different manufacters mouse and have tried all USB ports, including USB 3.0 port and ESATA port.
* We also tried a variation and only installed the drivers from Windows Update, which leaves a few unknown drivers... but we did it in order to try everything and still the same results.
* We used the 3.0 HP on many machines Diagnostic tools to remove the bad memory and other devices.
* The machines are usually this problem when you are under LOW to MEDIUM load. I'm not sure we have seen those who had during the high / extreme charge questions so we can exclude overheating.
* We've also changed the different power settings to avoid any issues that can be turn on / turn off ports etc. of energy saving.
* We tried the 2 latest versions of bios and have the same results.
The files that appear in the dump files are usbehci.sys, usbhub.sys and usbport.sys...
Were a software development company and are fairly well informed regarding this sort of thing. This has been interesting questions, because we have 12 computers with similar problems and we did on all combinations of operating system and the device driver installs as possible.
I know there have been serious problems with the Envy 15, but do not see too many people having problems with the Envy 17. So I don't know if it is possible that we would have gotten 12 bad computers or there is a serious problem with these laptops. I am waiting for some additional comments from HP support and wanted to post here in the meantime.
Its a shame, the computer is nice and the clarity of the screen is beautiful. For the moment, I would suggest someone by them after what we are going through. I've got developers attempt to use these and we are good a lot of code.
Thank you
Tim
You can send it to HP. [email protected], as well as any number of HP support or 12 serial numbers of ticket service...
In the meantime, I would say that, given the system configuration with the operating system that shipped with the device...
-
FilePicker crashes NDEF NFC push for all current application registered NDEFMessageBuilders
Using Blackberry 7.1, in a variety of devices:
We have an application with some screens recorded as NDEFMessageBuilder and NDEFPushStatusCallback. They correctly return the NDef message and it all works perfectly and wonderfully in all devices. Once you start using a FilePicker and navigate to any folder inside the filepicker, the application starts to be unable to pass anything througt NDEF/NFC, even the "buildNDEFMessages" is not called.
I tried to cancel the registration and re-registration of the NDEFMessageBuilder, placing the NDEFMessageBuilder in another class or same bundle... At tried all combinations possible on register/unregister, in all moments of possible timeline at the opening of the FilePicker. But nohing help, the application cannot send NDEF/NFC after opening the filepicker and access to a folder.
Once I Close / restart the app it sends NDef perfectly but, once you re - open the filepicker and access a folder inside the filepicker he keeps failing.
Curiosity: After the FilePicker breaks the NFC/Ndef, it starts sending the packages throught NFC LLCP FRAME_REJECT and all other applications work fine... but whoever opened the FilePicker aren't...
After a lot of research... it seems that the LLCP was a senior associate with two connect packets inside... one for the transfer and the other for the connection of the snep.
Maybe opening the filepicker here where the posibility to use nfc conncetion transfer or use the registered app snep connection, that is why the blackberry device returned an aggregated setting...
Some devices implement these packages aggregated and not others...
obiously I don't have he put up in my library nfc...I will implement as soon as possible.
Sorry for the inconvenience...
-
Smartphones blackBerry email and SMS combining not even when set on "handset."
Email and SMS/MMS all combined in main box mailbox messages until a few weeks ago. Now, when I get an SMS message, I'll still take the little icon showing me I have mail, but when I click on my mail box, there is no new message. I have to click on the menu, click the display folder, and then click SMS messages to display. My phone IS set on the combine (believe me, I checked and re-checked this hundred times already), and I even did a hard restart more than once to try to get it working again. Any ideas?
Thank you!!! It worked! (for anyone referring to this post, once I took the General Settings menu, I had to scroll 'services' and click on 'no service' to find the option "erase the pouch").
BUT now I can't restore my data to my phone. When I used the Desktop Manager, I clicked on restore and then came a box that says: "the data in the following databases...". Do you want to continue? ', followed by a list of my databases. Below that is a box for you to check that says «Clear the current memory of the OBU... and restore data...» ». This sentence is overlying (you can see in the text) the Yes/No to click on the box. So, even if I check the box in front of the text, I can't click on Yes or no. (nothing happens when I click on it). I tried to restart a few times Director of office, but I always get the same thing. Should I uninstall and reinstall?
-
Values of combination using substr
Hi team,
I have the script below to get all combinations of values of position to end the starting position
The format of the input string can be "AB CD" or "ABCD".
Start
FOR SELECT fir "AB CD" NM FROM DUAL
LOOP
S IN 1.length (fir.nm)
LOOP
dbms_output.put_line (' value of substr is ': substr (fir.nm, 1, s));
END LOOP;
END LOOP;
end;
Here is the output of the above script.
value of substr is A
value of substr is AB
value of substr is AB
value of substr is AB C
value of substr is AB CD
I need now below also values as output.
B
B AND C
B CD
C
CD
How can I get the above values also and output.
Pretty much the same as suggestion of Roger, just filtering strings with spaces attack/crawling.
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > VARIABLE letters VARCHAR2 (30);
SQL > EXEC: letters: = "AB CD;PL/SQL procedure successfully completed.
SQL > SELECT letters
2 (SELECT REPLACE (sys_connect_by_path (letter, '.'), '.') letters)
3. FROM (SELECT LEVEL l, substr (: letters, LEVEL 1) letter)
4 DOUBLE
5. CONNECT BY LEVEL<=>=>
6 CONNECT BY l = l + 1 PREREQUISITE)
7. WHERE letters NOT LIKE '% '.
8 AND letters NOT LIKE '% ';LETTERS
--------------------------------------------------------------------------------
A
AB
AB C
AB CD
B
B AND C
B CD
C
CD
D10 selected lines.
SQL > EXEC: letters: = "ABCD";
PL/SQL procedure successfully completed.
SQL > /.
LETTERS
--------------------------------------------------------------------------------
A
AB
ABC
ABCD
B
BRITISH COLUMBIA
BCD
C
CD
D10 selected lines.
SQL >
-
exclude all intersections of a member of the solution based on an intersection in the cube
Is it possible to exclude all intersections of a member of the solution based on an intersection in the cube?
Example of Dimensions
Fund
Center
Activity
Accounts
Method
F1
C1
A1
Recipes
Value
F1-1
C1-1
A1-1
R1
Percent
F1-2
C1-2
A1-2
R1-1
F1-3
C1-3
A1-3
R1-2
F2
C2
A2
R1-3
F2-1
C2-1
A2-1
R2
F2-2
C2-2
A2-2
R2-1
F2-3
C2-3
A2-3
R2-2
R2-3
Fees
E1
E1-1
E1-2
E1-3
E2
E2-1
E2-2
E2-3
For example, I would like to do something like this:
=============================================================
/ * Fix on all members of level 0 and value *.
DIFFICULTY (@LEVMBRS ("funds", 0), @LEVMBRS("Center", 0), @LEVMBRS("Activity", 0), @RELATIVE ("Revenue", 0))
'Value')
/ * If the Level0 Fund (Center, Activity) toplevel value of revenue is 0 or #MISSING * /.
IF (@CURRMBR ("funds")-> "Centre"->"activity"->"recipes"-> "Value" <. 00000001)
/ * Calculation of the judgment and DO NOT attach to any other point of intersection of the @CURRMBR (the "Fund") * /.
/ * or stop the calculation and move to the next member of the dimension of Fund in the fix * /.
ENDIF
/ * increase or decrease the current level 0 value based on what percentage he composed of revenues (expenditure - revenue), do all Level1Fund-> income = Level1Fund-> expense * /.
("Value" > 0) IF
'Value' = ('Value' * @PARENT (@CURRMBR ("funds"))-> 'Fees '->' Center '->' activity '->' value')
/ @PARENT (@CURRMBR ("funds"))-> 'Recipes '->' Center'-> 'activity '->' value ';
ENDIF
)
ENDFIX
=============================================================
The reason why I need to do this is for each fund Level0, there are more 57 million level 0 (Center, activity), back combinations. And the script takes 6 hours for all funds of which 80% could be ignored. I'm currently using the script below to not do the math on anything is zero or missing, but it still needs to fix on all combinations of 57 million by the Fund.
=============================================================
/ * Fix on all members of level 0 and value *.
DIFFICULTY (@LEVMBRS ("funds", 0), @LEVMBRS("Center", 0), @LEVMBRS("Activity", 0), @RELATIVE ("Revenue", 0))
'Value')
/ * If the current value is NOT 0 or #MISSING * /.
("Value" > 0) IF
/ * If the Level0 (Center, Activity) toplevel value of income fund is NOT 0 or #MISSING * /.
IF (@PARENT (@CURRMBR ("funds"))-> "Centre"->"activity"-> "Fees"->"value" > 0)
/ * increase or decrease the current level 0 value based on what percentage he composed of revenues (expenditure - revenue), do all Level1Fund-> income = Level1Fund-> expense * /.
'Value' = ('Value' * @PARENT (@CURRMBR ("funds"))-> 'Fees '->' Center '->' activity '->' value')
/ @PARENT (@CURRMBR ("funds"))-> 'Recipes '->' Center'-> 'activity '->' value ';
ENDIF
ENDIF
)
ENDFIX
=============================================================
I just thought if I could jump fixation on any intersection of this Fund, where the higher level of income is 0, I could save bugs by Level0 57 million Fund.
I am interested to hear any questions, suggestions or criticism. I worked on it for several days and can't seem to find a good solution in addition to recommending this calc will run once a week, while the process is supposed to difficulty currently runs nightly.
My apologies for the long-winded explanation, thanks for answer (s).
Post edited by: BrandonNeel Has changed IF (@CURRMBR ("funds")-> "Centre"->"activity"-> "Recipes"->"value" > 0) TO IF (@PARENT (@CURRMBR ("funds"))-> "Centre"->"activity"-> "Fees"->"value" > 0)
Hello
Just another thing as well. With the help of @PARENT and @CURRMBR will be slow. In the calc example you provided I don't know why you use @CURRMBR. You set on LEV 0 funds anyway, so it will scroll each fund an and evaluate each in turn. Also, if you need the value of a Parent of a specified member, what you are doing, then using @PARENTVAL is much faster.
You have specified the formula should be read;
'Value' = ('Value' * @PARENTVAL ('Fund', 'Charge '->' Center '->' activity'-> 'Value'))
/ @PARENTVAL ("Fund", "recipes"->"Center"->"activity"->"Value");
Thank you
Anthony
-
SELECT with the combination of two columns query
I need the research to write a nested select statement that would achieve the following.
Support I have a table as follows
TestTable
Name: Age: country
Test1: 10: USA
Test2: 11: us.
Test3: 12: us.
Test4: 11: Canada
Test5: 12: Canada
Now, I want to select in the table above gives the following information.
Get all the names of people who do not belong to this combination (10:USA, 11:Canada, 12:Canada). The list can be huge.
The result should be
Test1:10:USA
Test1:12:USA
If it was a combination, I can write
Select * from TestTable
the age where <>10 and <>country Canada
Also, I can also do
Select * from TestTable
the age where NOT IN (10,11) and country NOT IN (USA, COUNTRY)
But I do have that he would give me a correct result.sush_msn wrote:
Is there a way I can move the age and the country as a list on the query?You asked the right question.
Three things you need to know:
(1) your test data cover all combinations. This is the most comprehensive test data:
create table test_table1 as WITH AGES AS ( SELECT LEVEL+10 AGE FROM DUAL CONNECT BY LEVEL <= 3 ), COUNTRIES AS ( SELECT 'USA' COUNTRY FROM DUAL UNION ALL SELECT 'CANADA' COUNTRY FROM DUAL ) SELECT 'Test' || ROWNUM NAME, AGE, COUNTRY FROM AGES, COUNTRIES; NAME AGE COUNTRY -------------------------------------------- ---------- ------- Test1 11 USA Test2 11 CANADA Test3 12 USA Test4 12 CANADA Test5 13 USA Test6 13 CANADA
(2) now, here's the answer to your question. You can go back two or more values in an expression by putting parentheses around them.
SELECT * FROM TEST_TABLE1 WHERE (AGE, COUNTRY) NOT IN ( (11, 'USA'), (12, 'CANADA') ); NAME AGE COUNTRY -------------------------------------------- ---------- ------- Test2 11 CANADA Test3 12 USA Test5 13 USA Test6 13 CANADA
That's what made the Etbin above, but he used a select instead of a list of values.
(3) can AGE or COUNTRY ever be NULL? You want to return the records that have NULL values in them? If so, you must use NOT EXISTS instead of NO po WARNING: Etbin code needs a bit of change: "where (age, country) = (t.age, t.country)" should be "where (age, country) = ((t.age, t.country)) '. You must always additional brackets on the right side.
-
design of a grid of data for consolidation
Hello
The data grid, that I have now, I have #A and #C2 (type of Fund) in POV. So, when I Consolidez P & L, I choose #A = Net_Inc, #C2 = Fund1 and consolidate; When I consolidate balance sheet, I choose #A = Balance_Sheet, #C2 = Fund2 and consolidate - basically two measures to consolidate everything.
Unfortunately, Net_Inc, Balance_Sheet, Fund1 and Fund2 roll directly to #A and #C2. Is there a way I can design the grid, so I can consolidate everything just once?
Thank you in advance!Hello
I don't think to choose the different parent account to get a single entity all of the consolidated accounts.
Entity to HFM, the minimum building unit.
If you choose the correct entity, then run consolidation to the grid. You can get the result of the consolidation of all accounts of this entity.
James
-
generation combination of numbers from a given set of numbers
Hello experts,
Anyone know how I can do a number of combination generator in oracle?
For example I have 1, 2, 3, 4
and I want to list all combinations of 3 numbers
1 2 3
1 2 4
2 3 4
Y at - it something similar existing?
Thank you
Published by: Kevin CK on April 14, 2010 21:55How about this?
with t as ( select '10 22 33 44' col_val from dual ), t_new as ( select regexp_substr(col_val,'[^ ]+',1,level) col_val_new from t connect by level <= LENGTH(regexp_replace(col_val,'[^ ]+'))+1 ) select col_val from (select ltrim(sys_connect_by_path(col_val_new,' '),' ') col_val from t_new connect by prior col_val_new < col_val_new) where length(regexp_replace(col_val,'[^ ]+')) + 1 = 3
or
select col_val from (select ltrim(sys_connect_by_path(column_value,' '),' ') col_val from (select * from table(sys.odcinumberlist(10,22,33,44))) connect by prior column_value < column_value) where length(regexp_replace(col_val,'[^ ]+')) + 1 = 3 /
P.S:I, suppose you have 10 g or higher
Kind regards
Prazy -
I'm extremely new to oracle sql and I interviewed one I return all combinations of foods and drinks not ordered and I have no idea where to start. Here's what I got so far as a database
create table Customer_order (No order NUMBER primary key,
DATE_ORDER DATE,
date_required DATE,
address VARCHAR2 (30)
);
CREATE TABLE Food_order)
food_order # VARCHAR2 (7) primary key,.
Order number no reference Customer_order (order No.),
flat # varchar (5) makes reference to Dish(Dish#).
n_portions NUMBER);
CREATE TABLE Drink_order)
drink_order # primary key VARCHAR (5),
Order number no reference Customer_order (order No.),
drink the drink # VARCHAR (6) references (drink #).
n_units NUMBER);
CREATE TABLE flat)
flat # key primary varchar (5),
dish_name char (15),
vegetarian char (3),
price NUMBER);
CREATE TABLE drinking)
glass # VARCHAR (6) primary key,.
drink_name CHAR (6),
drink_type CHAR(9),
price NUMBER);
Insert into values customer_order ("00001", 3 April 09 ', ' 07-Apr-09', "St St. Andrew");
Insert into customer_order values ("00002", 5 April 09 ', 1 May 09', "St St. Andrew");
Insert into customer_order values ('00003', 12 April 09 ', 27 April 09', 'Union St');
Insert into customer_order values ('00004', 12 April 09 ', 17 April 09', "St St. Andrew");
Insert into values dish ("D0001', 'Pasta Cook', 'Yes',"6,00 ');
Insert into dish values ('D0002', 'Fish pie', 'no', '9: 00');
Insert into dish values ("D0003", "Steak and chips ', 'no', '14 h 00');
Insert into dish values ("D0004", "Stuffed peppers", 'yes', '11.50 ');
Insert into dish values ('D0005', 'Ham and rice', 'no', "7.25" ");
Insert into dish values ("D0006", "Lamb Curry", "no", "8.50 ');
Insert into drink values ('DR0001', 'Water', "gently", "1.0" ');
Insert into drink values ('DR0002', 'Cafes', 'Hot', '1.70 ');
Insert into drink values ('DR0003', 'Wine', "alcoholic", "3.00');
Insert into values of drink ("DR0004", "Beer", "alcohol", "2.30'");
Insert into values of drink ('DR0005', 'The', 'hot', ' 1.50' ");
Insert into food_order values ('F000001', '000001', 'D0003', ' 6');
Insert into food_order values ('F000002', '000001', 'D0001', ' 4');
Insert into food_order values ('F000003', '000001', 'D0004', ' 3');
Insert into food_order values ('F000004', '000002', 'D0001', ' 10');
Insert into food_order values ('F000005', '000002', 'D0002', ' 10');
Insert into food_order values ('F000006', '000003', 'D0002', ' 35');
Insert into food_order values ('F000007', '000004', 'D0002', ' 23');
Insert into drink_order values ('D000001', '000001', 'DR0001', ' 13');
Insert into drink_order values ('D000002', '000001', 'DR0002', ' 13');
Insert into drink_order values ('D000003', '000001', 'DR0004', ' 13');
Insert into drink_order values ('D000004', '000002', 'DROOO1', ' 20');
Insert into drink_order values ('D000005', '000002', 'DR0003', ' 20');
Insert into drink_order values ('D000006', '000002', 'DR0004', ' 15');
Insert into drink_order values ('D000007', '000003', 'DR0002', ' 35');
Insert into drink_order values ('D000008', '000004', 'DR0001', ' 23');
Insert into drink_order values ('D000009', '000004', 'DR0003', ' 15');
Insert into drink_order values ('D0000010', '000004', 'DR0004', ' 15');
Can someone help me please.Close this post, mark it as answered.
Maybe you are looking for
-
Recent calls tab does not keep the recent calls
Since the last update, the 'Récent' tab has been essentially useless. Only, he keeps a log of missed calls and only until you look at. I need a log of all calls - incoming, outgoing, missed calls - at least the last seven days. About half an hour ago
-
How to remove "Skype available" from the top of the notification page?
How to remove "Skype available" from the top of the notification page - useless promotion!
-
Satellite L300-1AQ and Wireless 'Lock Up' number
Once the small icon on the taskbar wireless displays a yellow triangle with an exclamation point in it and the internet stops operation (other computers in the work of the House very well if it isn't the router). Placing the cursor on the icon or cli
-
Pavilion 17.3 inch screen upgrade
Hello I set up a photography business and I need a better screen for my editing. I want a screen that rivals the retina of imac. the one I currently takes to long to edit because I guess where I think that changes must be made, and then send the pict
-
I want to buy a Pavilion Touchsmart 23 and connect a 23xi Pavilion to be used as a second monitor. How to connect the two because there is no HDMI output on the Touchsmart?