A line in two columns of split values
Hello world
I have the array with values such as
contract_no m
------------------------------------
123/456 co
op 123 456
123\555 wt
,456 cc
I want the output to be
dispatch_id vendor_id m
-------------------------------------------------------------
123 456 co
123 456 op
123 555 wt
456 cc
I tried to use the regexp_substr
Select m, REGEXP_SUBSTR('TMP.) CONTRACT_NO ',' [^ /-,] +') DISPATCH_ID,.
REGEXP_SUBSTR('TMP.) CONTRACT_NO ',' [^ /-,] +', 1.2) VENDOR_ID
OF TMP_DISPATCH_STATUS TMP
and I got the output as
vendor_id m dispatch_id
---------------------------------------------------------------------------------------------
Co TMP. CONTRACT_NO
TMP op. CONTRACT_NO
and so on
Can someone help me please in the query
Hello
"TMP. CONTRACT_NO' with single quotes is a string of 15 characters. It has nothing to do with any column in a table.
TMP. CONTRACT_NO without single quotes is the contract_no of the tmp table column.
I bet that you do not want the quotes in this case.
I hope that answers your question.
If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
Tags: Database
Similar Questions
-
Thick border line between two columns
Hello all;
I have a requirement where the user must be able to distinguish between two columns hnce asking a thick line, rather than the usual 'by default'.
Everything is 'Default' until then.
I clicked on properties of the 1st column and in the section "Border", I chose "Custom" and made the right wall of the cell in black color.
I see a thick border now, but it has eliminated the 'default' border separating lines. His party make the entire column look like a single cell.
I don't want any change with the exception only of the border of a column of a black line.
Any help is greately appreciated.
Thank you!The column properties-> Options of Style CSS custom (HTML only)-> use custom CSS Style->
the following CSS code
border-right-width: 1px; border-right-color: green;or go with someone with the necessary changes
Appreciate if you score as correct if it works
Published by: Srini VIEREN on December 11, 2012 16:43
-
Single line based on two columns and a single column
Dear members,
I have a table that contains duplicate rows, for which a request should be able to extract the unique row in the table. Here the unique is not based on a single column, but it should be in two columns and also check on the uniqueness on a column.
create table addr (varchar2 (10) firstname, lastname varchar2 (10), area varchar2 (3));
insert into values addr ('bob', 'james', 1');
insert into values addr ('bob', 'james', 1');
insert into values addr ('harry', 'bert', ' 1');
insert into values addr ('jimmy', 'bert', ' 1');
insert into values addr ('sam', 'mac', '1');
insert into values addr ('sam', 'Knight', '1');
insert into values addr ('tom', 'sand', '1');
insert into values addr ("cat", "mud", "1");
The query output must contain 3 lines.
Bob - james
Harry - bert or jimmy - bert [or the other of them], but not both
-Mac or sam - Sam Knight [or the other of them], but not both
Tom - sand
Cat - mud
SELECT firstname, lastname as total area WHERE addr = '1' GROUP by firstname, lastname; It takes no duplication of single column...
Any suggestions...SQL> with t_data as ( select 'bob' as firstname, 'james' as lastname, '1' as area from dual union all select 'bob', 'james', '1' from dual union all select 'harry', 'bert', '1' from dual union all select 'jimmy', 'bert', '1' from dual union all select 'sam', 'mac', '1' from dual union all select 'sam', 'knight', '1' from dual union all select 'tom', 'sand', '1' from dual union all select 'cat', 'mud', '1' from dual ) SELECT firstname, lastname, area FROM ( SELECT t.*, row_number() over(partition BY firstname order by 1) rn, row_number() over(partition BY lastname order by 1) rn1 FROM t_data t ) WHERE rn = 1 AND rn1 =1 ; FIRSTNAME LASTNAME AREA --------------- --------------- ---------- bob james 1 cat mud 1 jimmy bert 1 sam knight 1 tom sand 1 SQL>
-
How to put the two column values in two different colors unique online: MobApp
Hello
I develop Mobile Application.
I want to show two values in different columns in single row and first column value in either green or red and the second color the default column value.
the first value of the column is green when the value is greater than the second value of the column.
and the first column value in red when the value is less than the second value of the column.
The code I tried is:
--------------------------------------------------------------------------------------------
< tr:panelGroupLayout layout = "vertical" styleClass = 'list' >
< tr:panelList styleClass = "panelist ul > li > a" >
"" < tr:outputText value = "deliver: % #{row.bindings.OccCurr.inputValue},
inlineStyle = "background-color: #{rank." OccCurr > line. OccFcst? {'Green': 'Red'}; ">
"< tr:outputText value =" OccFcst: #{row.bindings.OccFcst.inputValue} % ">"
< / tr:outputText >
< / tr:outputText >
< / tr:panelList >
< / tr:panelGroupLayout >
------------------------------------------------------------------------------------------------
But the code above does not work.
Please, someone tell me what I need to do.
I apreciate your time and your help.
Sanchez.Hi Catherine,
Exactly, what is not working? Your OccCurr and OccFcst values are printed to the screen? I notice some questions.
(1) If you want to display two outputText on one line, you can surround them with a panelGroupLayout and set the page layout to horizontal.
(2) I don't think that you can place an outputText in outputText one another as in the codes that you have provided.
(3) your EL is inconsistent. What is #{row.bindings.OccCurr.inputValue} or #{line. OccCurr}? If your values are displayed, but the background color does not work, it could be the first.Kind regards
Amélie Chan -
Check the values in two columns, in the affirmative, then generate an error
Oracle 10g version
Hi gurus
I'm test1 table and it contains several columns, my requirement I want to create some sort of conditions or constraints before inserting data into test1, it will check that application_id or APPLICATION_TYPE_CD contains no values in the two columns...
I appreciate your advice. Thank you
/ / DESC test1
APPLICATION_ID NUMBER (10)
DATE OF APPLICATION_DT
APPLICATION_TYPE_CD VARCHAR2 (10)
DATE OF CREATED_DT
Concerning
MIT
You need a check as a constraint:
ALTER table test1 add constraint only_one
check ((application_id n'est pas null et application_type_cd est null) or)
(application_id is null and application_type_cd is not null))
John
-
Hello
I displays a table on the screen. This table is read only during the initial page load. I want to do only two columns as editable on five in a row when the user clicks a line using adf 12.1.3.
Is it possible in the adf. If possible how to handle this. Please help on this.
For example, drop table editable Full and then replace rest inputText (components entry in general) with af:outoutText, everything except those two.
And use the clickToEdit feature...?
-
two column values in a single column
Hi guys,.
I have a requirement that i want to be viewing the two column values in a single as column... values year & product will be exposed in a unique column values
Kind regards
Sree
Karthickumar Pillaiyarsamy yours is a database, in OBIEE is similar with some limitations...
Sree! you have 2 ways to do this: by using the CONCAT function or the | operator, examples here are 2 concatenating year, a space and production:
"Time". "" T05 annually name | ' ' || ' 'Products ' '. Product P1.
CONCAT ("Time". "T05 per year of name', CONCAT (" ","Products".)" P1 product"))
CONCAT in OBIEE accept only 2 params, so you if want to add a space between the 2 items, you must nest your function call.
In case your year column is a number, you can convert it to a string using CAST ("your column" as VARCHAR (10)).
-
Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?
Hello
2796614 wrote:
Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?
Of course, it is possible. According to what the text file looks like to, you can create an external table that treats the text file as if it were a table. Otherwise, you can always read the file in PL/SQL, using the utl_file package and INSERT of PL/SQL commands.
You have problems whatever you wantt? If so, your zip code and explain what the problem is.
Whenever you have any questions, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the exact results you want from these data, so that people who want to help you can recreate the problem and test their ideas. In this case, also post a small sample of the text involved file.
If you ask about a DML operation, such as INSERT, then INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
-
Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?
Guessing
Select nvl (x.col_a, y.col_b) the_column
from table_1 x,.
table_2 y
where x.pk = y.pk
Concerning
Etbin
-
Some columns of the values of the selected line returns NULL in the table of the adf.
Hello..
My version of jdev 11.1.1.5.0
I have a vision with some columns. This view is mapped to a table of adf with some of the displayed columns. My task is to get the column values selected line (including the values of the column not displayed).
But I'm certain values such as null, although there are values present when I run the query from the view.
My code:
DCIteratorBinding tableVO = ADFUtils.findIterator ("myVO");
ViewObject voTableData = tableVO.getViewObject ();
Line rowSelected = voTableData.getCurrentRow ();
+ / / codeto display column and the values +.
int x = 0;
* for (the names of the objects: rowSelected.getAttributeNames ()) {*}
* for (int i = x; i < rowSelected.getAttributeValues () .length; i ++) {*}
* System.out.println (x + "." + name + "=" + rowSelected.getAttribute (i)); *
break;
*}*
x ++ ;
continue;
*}*
MY table:
* < af:table value = "#{bindings.myVO.collectionModel}" *.
* var = "row" rows = "#{bindings.myVO.rangeSize}" *.
* EmptyText = "#{Bindings.myVO.Viewable?" "{'No data to display.': 'Access Denied.'}". *
* fetchSize = "#{Bindings.myVO.rangeSize}" *.
* rowBandingInterval = "0."
* filterModel = "#{Bindings.myVO.queryDescriptor}" *.
* queryListener = "#{Bindings.myVO.processQuery}" *.
* filterVisible = "true" varStatus = "vs."
* selectionListener = "#{myBean.method_onRowSelect}" *.
* rowSelection = "single" id = "t1" styleClass = "AFStretchWidth."
"* partialTriggers =": sbcClose: sbcOpen: socWarehouse. "
* inlineStyle = "height: 217px;" / > *.
Thank youQuestion: the attributes are not null in the DB?
The attributes are part of the past of the query select?
And they are part of the binding of the tree?Timo
-
to find values common to different lines, whereas a column is different
Hi all!
It was difficult to write about it, but the problem will clear with this example:
I have the following table with two columns, one for the user id and the second for id book. I'm writing a sql query to search for users who have read the same books.
First thing came to mind was the following:u_id b_id ----- ------ 1 122 1 185 1 231 1 316 1 329 1 355 2 110 2 151 2 260 2 376 2 539 . . . . . . 1077 1 1077 19 1077 34 1077 39 1077 47 1077 50
But, Yes, it gives the error subquery returns more than one line. Is is possible to do?SELECT * FROM myTable a WHERE b_id = (SELECT b_id FROM myTable b WHERE b.u_id <> a.u_id)
reis3k wrote:
I'm writing a sql query to search for users who have read the same books.
Do you mean find two (or more) users who read the same book? If so:
with t as ( select 1 u_id,122 b_id from dual union all select 1,185 from dual union all select 1,231 from dual union all select 1,316 from dual union all select 1,329 from dual union all select 1,355 from dual union all select 2,110 from dual union all select 2,151 from dual union all select 2,260 from dual union all select 2,376 from dual union all select 2,539 from dual union all select 3,110 from dual union all select 3,151 from dual union all select 3,260 from dual union all select 3,376 from dual union all select 3,539 from dual union all select 1077,1 from dual union all select 1077,19 from dual union all select 1077,34 from dual union all select 1077,39 from dual union all select 1077,47 from dual union all select 1077,376 from dual ) select b_id, rtrim(xmlagg(xmlelement(e,u_id,',').extract('//text()') order by u_id),',') user_list from t group by b_id having count(*) > 1 / B_ID USER_LIST ---------- ---------- 110 2,3 151 2,3 260 2,3 376 2,3,1077 539 2,3 SQL>
Or do you mean find two (or more) users who read exactly the same set of books? If so:
with t as ( select 1 u_id,122 b_id from dual union all select 1,185 from dual union all select 1,231 from dual union all select 1,316 from dual union all select 1,329 from dual union all select 1,355 from dual union all select 2,110 from dual union all select 2,151 from dual union all select 2,260 from dual union all select 2,376 from dual union all select 2,539 from dual union all select 3,110 from dual union all select 3,151 from dual union all select 3,260 from dual union all select 3,376 from dual union all select 3,539 from dual union all select 1077,1 from dual union all select 1077,19 from dual union all select 1077,34 from dual union all select 1077,39 from dual union all select 1077,47 from dual union all select 1077,376 from dual ) select book_list, rtrim(xmlagg(xmlelement(e,u_id,',').extract('//text()') order by u_id),',') user_list from ( select u_id, rtrim(xmlagg(xmlelement(e,b_id,',').extract('//text()') order by b_id),',') book_list from t group by u_id ) group by book_list having count(*) > 1 / BOOK_LIST USER_LIST ------------------------------ ----------- 110,151,260,376,539 2,3 SQL>
SY.
-
selection of lines corresponding to two columns with two entry tables
I have a table with two columns int primary key tab1. id1 and id2.
Now I have two created two tables of figures: array1 {1, 2, 3,...} and {0, 1, 0,...} array2 Arrays have the same length.
I want to do a select:
Select * from tab1 where tab1.id1 = array1.column_value and tab1.id2 = array2.column_value;
If I want to receive 13 lines with this request, I had 169 because it tries to match all the different combinations in the tables.
If I do it with a loop for:
for i of array1
loop
Select * from tab1 where tab1.id1 = array1 (i) and tab1.id2 (i);
end
That should illustrate what I want to do, I just thought it would be faster if I could do it without a loop, do not use the pl/sql. Can it be done? If not, should I use a loop for with bulk collect somehow?SQL> with t as ( select 1 id1, 0 id2 from dual union all select 2, 0 from dual union all select 3, 0 from dual union all select 4, 1 from dual ) -- -- select id1, id2 from t, (select rownum rn1, a1.* from table (sys.odcinumberlist (1, 2, 3, 4)) a1) a1, --- array1 (select rownum rn2, a2.* from table (sys.odcinumberlist (0, 1, 0, 1)) a2) a2 --- array2 where (id1, id2) in ( (a1.column_value, a2.column_value)) and rn1 = rn2 / ID1 ID2 ---------- ---------- 1 0 3 0 4 1 3 rows selected.
-
How to update columns with the value of other lines in the same table
Hello
I use Oracle 11.2, I'd use SQL statements to update a column based on values in other rows in the same table. Here are the details:
create table TB_test (number 4 myId, crtTs date, date of MDPU);
insert into tb_test (1, to_date ('20110101', 'YYYYMMDD'), null);
insert into tb_test (1, to_date ('20110201', 'YYYYMMDD'), null);
insert into tb_test (1, to_date ('20110301', 'YYYYMMDD'), null);
insert into tb_test (2, to_date ('20110901', 'YYYYMMDD'), null);
insert into tb_test (2, to_date ('20110902', 'YYYYMMDD'), null);
After you run the SQL code, I would like to have the following result:
1, 20110101, 20110201
1, 20110201, 20110301
1, 20110301, null
2, 20110901, 20110902
2, 20110902, null
Thanks for your suggestion.I guess you need this, otherwise please explain logic correctly:
SQL> merge into tb_test t 2 using ( 3 select rowid as rid 4 , lead(crtts) over(partition by myid order by crtts) as updts 5 from tb_test 6 ) v 7 on (t.rowid = v.rid) 8 when matched then update 9 set t.updts = v.updts 10 ; 5 rows merged. SQL> select * from tb_test order by 1,2; MYID CRTTS UPDTS ---------- --------- --------- 1 01-JAN-11 01-FEB-11 1 01-FEB-11 01-MAR-11 1 01-MAR-11 2 01-SEP-11 02-SEP-11 2 02-SEP-11
-
Splits the string into two columns
Can someone please help me the following
I want to divide into two columns URL and ID /cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107
Result must be
Temporary table
< font color = "red" > URL < / police > < font color = 'blue' > ID < / make >
< font color = "red" > /cfd/abc.html < / police > < font color = "blue" > 107 < / make >
< font color = "red" > / night/aaa/page 1 < / police > < font color = "blue" > 107 < / make >
< font color = "red" > / can/MLP/Page2 < / police > < font color = "blue" > 107 < / make >
There can be N number of comma separated URLs, but there will be only 1 separate ID which is the vertical bar (|)Try this,
SQL> WITH T 2 AS (SELECT '/cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107 ' str FROM DUAL UNION ALL 3 SELECT '/cfd/def.html,/bbbb/bbbb/Page1,/lll/MLP/Page3|108 ' str FROM DUAL) 4 SELECT REGEXP_SUBSTR ( str, '[^,|]+', 1, lvl) URL, 5 REGEXP_SUBSTR ( str, '[^|]+', 1, 2) ID 6 FROM T, 7 (SELECT LEVEL lvl 8 FROM (SELECT MAX (LENGTH (REGEXP_REPLACE ( str, '[^,]'))) mx FROM T) 9 CONNECT BY LEVEL <= mx + 1) 10 WHERE Lvl - 1 <= LENGTH (REGEXP_REPLACE ( str, '[^,]+')) 11 order by id,lvl; URL ID -------------------------------------------------- ------------------------------------------------- /cfd/abc.html 107 /night/aaa/Page1 107 /can/MLP/Page2 107 /cfd/def.html 108 /bbbb/bbbb/Page1 108 /lll/MLP/Page3 108 6 rows selected. SQL>
G.
-
Update line in the column-based database
Hello
I am trying to find a way to update a row that has a SQL database based on two columns. If the command and the match number sensor order number and sales sensor that already exists in the database, I want to update the column of reading of the sensor. If not exists then I want that it creates a new line. How would I go to do this?
Thank you
Chris
You can use the tools of DB Query.vi Execute. Here is an example of a MS Access 2010 database where a column value is updated in all rows satisfying the WHERE conditions.
Ben64
Maybe you are looking for
-
How does Firefox crash reporter know my email address?
When Firefox crashes, crash reporter is pre-populated with my email address. How does do that? I don't remember precisely what gives to any point in the past, other than to sign up for this help forum some time back. Even if I * fact * enter it in th
-
HP pavilion p6630f supports output via connector dvi - d to dvi - d to hdmi audio adapter?
HP pavilion p6630f supports output via connector dvi - d to dvi - d to hdmi audio adapter?
-
Original title: lost file you downloaded. As my AVG is about to expire, I, following the advice of the man of my computer to download, uninstall and then install. has taken the following steps. went to Avg free. downloaded and it was lowered to the t
-
Allowed to 5 GHz, 5 GHz transmit do not - WRT1200ac
I had the WRT1200AC for a little while and just noticed that the 5 GHz band does not transmit when I looked into why my wireless internet speed was low. I checked my router settings, bands of 2.4 and 5 Ghz are enabled in the router configuration. I
-
Original title: Bit Locker Drive Encryption problem . I bought my laptop with windows 7 home basic operating system. After 1 year my Software Engineer friend makes me Express Windows Ultimate.Then upgrade after a few viral problems, I recovered my sy