Find the lines with a single record
Sorry for the description of the thread crap, I couldn't think more concise and useful.
This is my sample data (using Oracle 11.2.0.3):
WITH tbl_data AS (SELECT 1234 acnum, 'bob customer' party_name, 6565 party_id, 'BILL_TO' site_use FROM DUAL UNION ALL SELECT 4234 acnum, 'cheese waffles' party_name, 423423 party_id, 'SHIP_TO' site_use FROM DUAL UNION ALL SELECT 1223 acnum, 'terry trees' party_name, 32423 party_id, 'BILL_TO' site_use FROM DUAL UNION ALL SELECT 1223 acnum, 'terry trees' party_name, 32423 party_id, 'SHIP_TO' site_use FROM DUAL UNION ALL SELECT 1223 acnum, 'terry trees' party_name, 32423 party_id, 'LEGAL' site_use FROM DUAL) select * from tbl_data;
I would like to return only records that have a single address or a single SHIP_TO, but not records that have both an address AND SHIP_TO.
Something as simple as a condition at the end of:
WHERE site_use = 'BILL_TO' OR site_use = 'SHIP_TO'
Not obviously doesn't work because it returns all rows with the address or SHIP_TO, rather than those with a single GOLD the other.
I need to find data on our system where customers have a single record, but not both and am stuck working logic.
Any advice would be much appreciated.
Thank you very much
Hello
Thanks for posting the sample data. Don't forget to post the exact results you want from these sample data.
"Record" is not a term of standard database. Explain what you mean by the latter.
Depending on what you want, here's a way:
SELECT acnum
OF tbl_data
WHERE site_use IN ('address', 'SHIP_TO')
GROUP BY acnum
HAVING COUNT (DISTINCT site_use) = 1
;
Tags: Database
Similar Questions
-
Help, please...
I have a 2d double table and I want to find a specific line, an extract to new table 2d.
My 2d array is:
100 31.3 25.3 32.1 25.6 100 31.3 25.3 32.1 25.6 160 32.4 25.5 33.5 26 170 33.2 25.8 34.3 26.2 100 33.9 26 35.2 26.4 160 32.4 25.5 33.5 26 160 32.4 25.5 33.5 26 100 31.3 25.3 32.1 25.6 170 33.2 25.8 34.3 26.2 and I want to find the line with the numbers 100,160,170 and build new table 2d
100 31.3 25.3 32.1 25.6 160 32.4 25.5 33.5 26 170 33.2 25.8 34.3 26.2 Please help... tnx, tnx
I guess you should be more specific about your question. If you have decided to find values that are present in the 1st column, you can use search table 1 d and pass the index to the 2D array index so you will get a table 1 d of line then build the table by searching for the element.
That's what explains Yamaeda
-
SQL Loader - ignore the lines with "rejected - all null columns."
Hello
Please see the attached log file. Also joined the table creation script, data file and the bad and throw the files after execution.
Sqlldr customer in the version of Windows-
SQL * Loader: release 11.2.0.1.0 - Production
The CTL file has two clauses INTO TABLE due to the nature of the data. The data presented are a subset of data in the real world file. We are only interested in the lines with the word "Index" in the first column.
The problem we need to do face is, according to paragraph INTO TABLE appears first in the corresponding CTL lines file to the WHEN CLAUSE it would insert and the rest get discarded.
1. statement of Create table : create table dummy_load (varchar2 (30) name, number, date of effdate);
2. data file to simulate this issue contains the lines below 10. Save this as name.dat. The intention is to load all of the rows in a CTL file. The actual file would have additional lines before and after these lines that can be discarded.
H15T1Y Index | 2. 19/01/2016 |
H15T2Y Index | 2. 19/01/2016 |
H15T3Y Index | 2. 19/01/2016 |
H15T5Y Index | 2. 19/01/2016 |
H15T7Y Index | 2. 19/01/2016 |
H15T10Y Index | 2. 19/01/2016 |
CPDR9AAC Index | 2. 15/01/2016 |
MOODCAVG Index | 2. 15/01/2016 |
H15TXXX Index | 2. 15/01/2016 |
H15TXXX Index | 2. 15/01/2016 |
3. the CTL file - name.ctl
DOWNLOAD THE DATA
ADD
IN THE TABLE dummy_load
WHEN (09:13) = "Index".
TRAILING NULLCOLS
(
COMPLETED name BY ' | ',.
rate TERMINATED BY ' | '.
COMPLETED effdate BY ' | '. ' TO_DATE (: effdate, "MM/DD/YYYY").
)
IN THE TABLE dummy_load
WHEN (08:12) = "Index".
TRAILING NULLCOLS
(
COMPLETED name BY ' | ',.
rate TERMINATED BY ' | '.
COMPLETED effdate BY ' | '. ' TO_DATE (: effdate, "MM/DD/YYYY").
)
invoke SQL loader in a file-> beats
C:\Oracle\product\11.2.0\client\bin\sqlldr USERID = myid/[email protected] CONTROL=C:\temp\t\name.ctl BAD=C:\temp\t\name_bad.dat LOG=C:\temp\t\name_log.dat DISCARD=C:\temp\t\name_disc.dat DATA=C:\temp\t\name.dat
Once this is run, the following text appears in the log file (excerpt):
Table DUMMY_LOAD, charged when 09:13 = 0X496e646578 ('Index' character)
Insert the option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Position Len term Encl. Datatype name
------------------------------ ---------- ----- ---- ---- ---------------------
NAME FIRST * | CHARACTER
RATE NEXT * | CHARACTER
EFFDATE NEXT * | CHARACTER
SQL string for the column: ' TO_DATE (: effdate, "MM/DD/YYYY").
Table DUMMY_LOAD, charged when 08:12 = 0X496e646578 ('Index' character)
Insert the option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Position Len term Encl. Datatype name
------------------------------ ---------- ----- ---- ---- ---------------------
NAME NEXT * | CHARACTER
RATE NEXT * | CHARACTER
EFFDATE NEXT * | CHARACTER
SQL string for the column: ' TO_DATE (: effdate, "MM/DD/YYYY").
Record 1: Ignored - all null columns.
Sheet 2: Cast - all null columns.
Record 3: Ignored - all null columns.
Record 4: Ignored - all null columns.
Sheet 5: Cast - all null columns.
Sheet 7: Discarded - failed all WHEN clauses.
Sheet 8: Discarded - failed all WHEN clauses.
File 9: Discarded - failed all WHEN clauses.
Case 10: Discarded - failed all WHEN clauses.
Table DUMMY_LOAD:
1 row loaded successfully.
0 rows not loaded due to data errors.
9 lines not loading because all WHEN clauses were failed.
0 rows not populated because all fields are null.
Table DUMMY_LOAD:
0 rows successfully loaded.
0 rows not loaded due to data errors.
5 rows not loading because all WHEN clauses were failed.
5 rows not populated because all fields are null.
The bad file is empty. The discard file has the following
H15T1Y Index | 2. 19/01/2016 |
H15T2Y Index | 2. 19/01/2016 |
H15T3Y Index | 2. 19/01/2016 |
H15T5Y Index | 2. 19/01/2016 |
H15T7Y Index | 2. 19/01/2016 |
CPDR9AAC Index | 2. 15/01/2016 |
MOODCAVG Index | 2. 15/01/2016 |
H15TXXX Index | 2. 15/01/2016 |
H15TXXX Index | 2. 15/01/2016 |
Based on the understanding of the instructions in the CTL file, ideally the first 6 rows will have been inserted into the table. Instead the table comes from the line 6' th.
NAME RATE EFFDATE H15T10Y Index 2 January 19, 2016 If the INTO TABLE clauses were put in the CTL file, then the first 5 rows are inserted and the rest are in the discard file. The line 6' th would have a ""rejected - all columns null. "in the log file. "
Could someone please take a look and advise? My apologies that the files cannot be attached.
Unless you tell it otherwise, SQL * Loader assumes that each later in the table and what clause after the first back in the position where the previous left off. If you want to start at the beginning of the line every time, then you need to reset the position using position (1) with the first column, as shown below. Position on the first using is optional.
DOWNLOAD THE DATA
ADD
IN THE TABLE dummy_load
WHEN (09:13) = "Index".
TRAILING NULLCOLS
(
name POSITION (1) TERMINATED BY ' | '.
rate TERMINATED BY ' | '.
COMPLETED effdate BY ' | '. ' TO_DATE (: effdate, "MM/DD/YYYY").
)
IN THE TABLE dummy_load
WHEN (08:12) = "Index".
TRAILING NULLCOLS
(
name POSITION (1) TERMINATED BY ' | '.
rate TERMINATED BY ' | '.
COMPLETED effdate BY ' | '. ' TO_DATE (: effdate, "MM/DD/YYYY").
)
-
With Windows Vista and Windows 7, I put the mouse to use the option with a single click to open files and programs desktop. I can't find this option in Windows 8.
HelloThanks for the post about Microsoft Community.I understand that you don't want to use the simple click instead of double click of the mouse that you used in Windows Vista and 7.I would ask you to please follow the steps below to activate the option just click on the button of the mouse in Windows 8.un) Please move the cursor to the bottom right and click on the search box, which is the first option in this Panel.b) in the search box, type Control Panel, and then click Control Panel.c) after opening the Control Panel, you will see many programs such as the system, network and security, Internet, hardware and sound, and other programs. Click "appearance and personalization".d) now click on the folder option to open it.e) now you will see many options in the folder option. Now, click single-click to open an item (point to select).f) now click on apply and ok to turn this feature on your computer.I hope your problem is solved now. Please feel free to write back if the problem still persists. -
Select the lines with the maximum value for a date where another column is different from 0
Hello
I need to write a query on a table (called DEPRECIATION) that returns only the rows whose date maximum (PERENDDAT_0 column) for a specific record (identified by AASREF_0), and where the other column in the table called DPRBAS_0 is different from 0.
If DPRBAS_0 is equal to 0 in all the lines of a specific record, then return the line with date maximum (PERENDDAT_0 column).
To be clearer, I give the following example:
Suppose we have the following data in the table of DEPRECIATION:
AASREF_0 PERENDDAT_0 DPRBAS_0 I20110010743 31/12/2015 0 I20110010743 31/12/2014 0 I20110010743 31/12/2013 0 I20110010856 12/31/2016 0 I20110010856 31/12/2015 0 I20110010856 31/12/2014 332 I20140012238 12/31/2016 445 I20140012238 31/12/2015 445 I20140012238 31/12/2014 0 The query must return only the following lines:
AASREF_0 PERENDDAT_0 DPRBAS_0 I20110010743 31/12/2015 0 I20110010856 31/12/2014 332 I20140012238 12/31/2016 445 Thanks a lot for your help!
This message was edited by: egk
Hello Egk,
The following query works for you.
SELECT AASREF_0, PERENDDAT_0, DPRBAS_0
FROM (SELECT AASREF_0,
PERENDDAT_0,
DPRBAS_0,
ROW_NUMBER)
DURING)
AASREF_0 PARTITION
ORDER BY
CASE WHEN DPRBAS_0 <> 0 THEN 1 OTHER 0 END DESC,.
PERENDDAT_0 DESC)
RN
DEPRECIATIONS)
WHERE rn = 1
-
Select the line with the smallest Beach
Hello
I am trying to build a complex query...
He must select the line with the inner range...
I'll explain for example:
Location of poolsize ID value
1 32 8
2 40 6
3 42 8
4-36-3
I want to select the line where the fork between value and value + poolsize is shared also with the other location...
so:
1 is 32-40 (in A place)
2 is 40-46 (in place)
3 is 42-48 (location B)
4 is 36-39 (at location B)
4 is located at 1 (and there are different places...) so sql must return to the fourth line.
Any help will be appreciated!
Thank you
fcbmanHello
fcbman1899 wrote:
Hello
I am trying to build a complex query...
He must select the line with the inner range...I'll explain for example:
Location of poolsize ID value
1 32 8
2 40 6
3 42 8
4-36-3Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, in order to let the people who want to help you re-Ridge the problem and test their ideas.
See the FAQ forum {message identifier: = 9360002}I want to select the line where the fork between value and value + poolsize is shared also with the other location...
so:
1 is 32-40 (in A place)
2 is 40-46 (in place)
3 is 42-48 (location B)
4 is 36-39 (at location B)4 is located at 1 (and there are different places...) so sql must return to the fourth line.
To find all the rows that are within the range of at least one other line with another location:
SELECT * FROM table_x m WHERE EXISTS ( SELECT 1 FROM table_x WHERE location != m.location AND value <= m.value AND value + poolsize >= m.value + m.poolsize ) ;
When you talk of the "" * most * inner range ", do you mean that you might have another line, such as"
INSERT INTO table_x (id, vlue, poolsize, location) VALUES (5, 37, 1, 'C');
which is inside the range of id - 4, and that's why you wouldn't have id = 4? If so, include examples in the results and data sample yout. You can do this with a query CONNECT BY, or, depending on your version of Oracle, a WITH recursive clause.
-
Load the page with a selected record
I have a PHP page that is linked to a database of mySql with 2 recordets. The first presents a simple list of records then a link to the presentation of the details of these records in a table below. Everything works fine but the loading of the page details table is, of course, an empty shell until the user clicks on the link url in the list which loads the record in the table.
I'd like the page to load with a recording of the sample inside so that it looks better - preferably a record at random, but if not, the first in the list. What is the easiest way to achieve this?
Ah ok, so it seems that the first Recordset is filtered on a certain setting? You view several records in the first Recordset in a region of repatriation? And the second table shows the details of a single record, but there should be a folder in the first Recordset. Hmmmm. The first thing that comes to mind, is to set a variable and fill it with the ID value of the first record since the first Recordset. Then use this variable as a default in the second set. I am not sure of is this: when you fill out the variable, it will either use the first record in the game or the Recordset returns actually several records with different values for each ID, it can raise an error.
I don't usually use the result of a recordset to filter a second, but I did - but it was only when the first Recordset returns only a single record.
-
I have a new pc and save the bookmarks. Where can I find the folder with bookmarks?
I have a new pc and I want to save the old bookmarks. Where can I find the folder with bookmarks?
See this:
http://support.Mozilla.com/en-us/KB/recovering+important+data+from+an+old+profile -
Could not find the feature with Id: blackberry.invoke.message arguments
Hi, I am using the message application, while the building, I have an error to BB 10 WebWorks SDK
failed to find the feature with Id : blackberry.invoke.message arguments
This is supported in this beta version of the SDK, simiarly there are also some features that are not available with this beta SDK release. Where can I find abt it.
Concerning
Rakesh Shankar.P
The blackberry.invoke.messages API is not currently supported in the BB10 WebWorks SDK BETA.
At the time of writing, the following APIs are currently supported in the BETA release:
- BlackBerry.Connection
- BlackBerry.Event
- BlackBerry.Identity
- BlackBerry.Invoke
- BlackBerry.app
- BlackBerry.System
- BlackBerry.UI.Dialog
For the complete list and to update the supported APIs, see the WebWorks API reference guide
-
Unable to find the component with an absolute reference
Hello
I have an RESP search page that has an LOV attached to the name of responsibility search column.
The page works fine on my Jdev, when I transfer the files on the server and click on the page I get error below.
«oracle.apps.fnd.framework.OAException: oracle.adf.mds.exception.MDSRuntimeException: unable to find the component with an absolute reference = / win/oracle/apps/win/respmap/lov/webui/RespNameVORN, XML Path = null.» Please check that the reference is valid and the definition of the component exists on the file system or in the MDS repository. »
The LOV RN xml is present in the location on the server. The page has been imported successfully, verified using jdr_utiils.print_document.
I was impossible to import LOV RN xml using XML importing, throwing below error.
< row 2, column 45 >: XML-20112: Error (fatal error) opening external DTD 'jbo_03_01.dtd '.
WARNING: Could not find the level of customization of document value ' / victory/oracle/apps/victory/respmap/lov/Server/RespNamesVO.
No Protocol: jbo_03_01.dtd
The Oracle note Doc ID 848851.1 said you should not import the xml of region LOV separately, it is imported with page.
Please help me to solve this error.
Thank you
Kalai
Kalai,
km1612 wrote:
Command used with import error.
---------
$ oracle.jrad.tools.xml.importer.XMLImporter java /DEVL/apps/comn/java/classes/win/oracle/apps/win/respmap/lov/server/RespNamesVO.xml - username *-password *-dbconnection "(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = *)(PORT=***)) (CONNECT_DATA = (SID = DEVL)))" rootdir - / DEVL/apps/comn/java/classes-rootdir/DEVL/apps/comn/java/classes
----
Your LovRN file is /win/oracle/apps/win/respmap/lov/webui/RespNameVORN.xml
Not /win/oracle/apps/win/respmap/lov/server/RespNamesVO.xml
If please change the XMLImporter with the correct file and try again.
See you soon
AJ
-
find the percent with grep sign
Hello. I know it must be simple, but I can't seem to find it: how to find the percent with grep sign? Or % or -% nor [%] seem to do.
Thank you
There is nothing in particular the % sign: you should be able to find it by using one of the three methods you have tried. Have a good overview of the control panel search/replace. Don't find it what domain contain only the %? No space lurking here? It is on a locked layer? You have a style of paragraph or character set in the Panel "Find format '?
Peter
-
can not find the line in the graph editor
I put a few keyframes left the movement spuqre. but I can't find the line in the graph Editor.
Please help me
You must select a property to view the chart.
-
I bought Lightroom 3 five years ago to a retailer, but I can't find the CD with the serial number. How can I do to install this version? Thanks Gerard
Hello
I created the CD original LR3 and, of course, serialNumber. It's great!
Thank you for your team!
-
How to cut all the clips with a single command
How to cut all the clips with a single command
In the Toolbox.
-
I need script to remove the line with 2 points, another script to remove next lines
I need script to remove the line with 2 points, another script to remove next lines of two scripts needed help please
Thanks in advance
Concerning
Lakshmiganth
Scroll through each pathitem and look at the length of his pathPoints group. If the length is equal to 2 and then use the remove() method to remove it. For example (this is rough, off the top of my head):
var lines = new Array();
for (i = 0; I have< app.activedocument.pathitems.length; ="" i++)="">
If (app.activeDocument.pathItems [i].pathPoints.length == 2) {}
Lines.push (App.activeDocument.pathItems [i]);
}
}
for (i = 0; I have< lines.length; ="" i++)="">
Lines [i]. Remove();
}
Maybe you are looking for
-
Recently, I tried to upgrade to the latest version of iTunes. The installation froze and since then I can not download iTunes ("is there a problem with this Windows Installer package. A program required for this install to complete could not be run.
-
Portege R500 - CD/DVD drive does not work
I have the problem. I just tried to delete upper and lower filters, but it did not work.I called Toshiba support and they suggested reinstalled windows, which I am not a response, I'm satisfied. I am running XP with SP3, and I'm starting to wonder if
-
I need to replace my HP Pavilion Sleekbook 14-b030tx...
Dear team,
-
Can't post message on the Windows Live Mail Portal
I tried to post a message about a problem with Windows Live Mail on messaging portal. Whenever I click the button submit my message I get an error saying "There was an error while processing your request". The procedure I tried is as follows: 1. Sel
-
Recently, I uninstalled Webshots from my computer. Now my show desktop icon disappeared from my quick launch task bar. Can someone help me get it back?