Oracle PL SQL Question to get some data to oracle tables descrepancy
Version of databaseOracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE Production 9.2.0.8.0
AMT for HP - UX: 9.2.0.8.0 - Production Version
NLSRTL Version 9.2.0.8.0 - Production
created a few sample data
drop table tab1 purge;
create table tab1 (DEPT_ID COMP, qc_subtype_id char (4), EQUIP_CODE varchar2 (20), create_time date);
Insert into tab1 values(13,'1026','HEMORYA011',sysdate);
Insert into tab1 values(13,'1012','HEMORYA011',sysdate);
Insert into tab1 values(95,'1026','HEMORYA121',sysdate);
Insert into tab1 values(95,'1012','HEMORYA121',sysdate);
----------------------
Insert into tab1 values(13,'1026','HEMORYA014',sysdate);
Insert into tab1 values(13,'1012','HEMORYA005',sysdate);
Insert into tab1 values(13,'1012','HEMORYA013',sysdate);
Insert into tab1 values(95,'1012','HEMORYA013',sysdate);
Insert into tab1 values(95,'1012','HEMORYA148',sysdate);
commit;
I need to get a query to get the records of the gap
Dept HEMORYA014 13 lack 1012
HEMORYA005 dept 12 lack 1026
Dept HEMORYA013 13 lack 1026
The dept 95 lack 1026 HEMORYA013
The dept 95 lack 1026 HEMORYA148
I want to show the latter on the report
Thanks in advance.
Thanks for posting a unit test.
I hope it will work for you, but maybe you will need to set the WHERE clause (add additional predicates).
SQL> select equip_code
2 from ( select equip_code
3 , count(distinct qc_subtype_id)
4 from tab1
5 group by equip_code
6 having count(distinct qc_subtype_id)<2
7 )
8 order by equip_code;
EQUIP_CODE
--------------------
HEMORYA005
HEMORYA013
HEMORYA014
HEMORYA148
Tags: Database
Similar Questions
-
Is it possible to see/get the data from the table to a dump file
I have files dmp generated using expdp on oracle 11 g...
expdp_schemas_18MAY2013_1.dmp
expdp_schemas_18MAY2013_2.dmp
expdp_schemas_18MAY2013_3.dmp
Can I use a settings file given below to get the data from the table in the file sql or impdp the only option to load the data of table in database.
VI test1.par
USERID = "/ as sysdba".
DIRECTORY = DATA
dumpfile=expdp_schemas_18MAY2013%S.dmp
SCHEMAS = USER1, USER2
LOGFILE = user_dump_data.log
SQLFILE = user_dump_data. SQL
and impdp parfile = test1.par.
No,
DataPump cannot retrieve a dumpfile data in a flat file.
Dean
-
How to write a simple select query to get the data of the table as an XML.
How to write a simple select query to get the data of the table as an XML. In the query, I'm just adding items below which i need be there in the XML document
I have need to add the root tag as well in the beginning and the end of < root > < / root > this xml file. Please advice if this is possible with the select queryselect '<test_tag>'||EMP_NAME||'</test_tag>','<date>'||sysdate||'</date>' from temp_table where id_num BETWEEN 1 AND 10;
without using XMLGEN, XMLQUERY or any other packages built and function?I need to URL escapes with the UTF-8 code points that we have already achieved using the utl_http package. Please help how to do that without using the utl_http package.
What is wrong with him?
At present, the only way I can think of to avoid a call to UTL_HTTP. SET_BODY_CHARSET is to write your own little wrapper.
In this way, you can specify the Boolean parameter or omit it if you choose to use named parameters:SQL> create or replace function my_url_escape (url in varchar2) 2 return varchar2 3 deterministic 4 is 5 begin 6 return utl_url.escape(url, false, 'AL32UTF8'); 7 end; 8 / Function created SQL> select my_url_escape('http://some.uri.com/param?lang=fr&text=contrôle') from dual; MY_URL_ESCAPE('HTTP://SOME.URI -------------------------------------------------------------------------------- http://some.uri.com/param?lang=fr&text=contr%C3%B4le
-
output of Get-store data in the table (datagrid)
Hello
I'm trying to get the output of get-store data in a table (datagrid).
Code:
Function Get-data warehouses
{
$array = new System.Collections.ArrayList object
$Script: GetDatastore = Get-Datastore
$array. AddRange ($GetDatastore)
$dataGrid1.DataSource = $array
$form1.refresh)
}error:
Das Argument '0' mit dem Wert "local_datastore01" as "AddRange' nicht den Typ"System.Collections.ICollection"konvertiert werden kann:" Der Wert "local_datastore01" vom Typ VMware.VimAutomation.Cl «»»
ient20. DatastoreImpl' nicht den Typ "System.Collections.ICollection" konvertiert werden kann. »
-snip-
+ $array. AddRange < < < < ($GetDatastore)
+ CategoryInfo: NotSpecified: (:)) [], MethodException)
+ FullyQualifiedErrorId: MethodArgumentConversionInvalidCastArgumentComment:
If I replace the query data get store-get - VM the script works great!
What's wrong? any suggestions?
Many thanks and greetings
Hello
This particular Get-Datastore call returns a single object, which cannot be converted to the ICollection. But you can do something like this:
If ($GetDatastore-[table]) {}
$array. AddRange ($GetDatastore)
} else {}
$array. Add ($GetDatastore)
}
It will manage both situations - when you get the data object store or table of data warehouses.
Vitali
Team PowerCLI
-
Need a sql query to get several dates in rows
Hi all
I need a query to get the dates of the last 7 days and each dates must be in a line...
but select sysdate double... gives a line...
Output of expexcted
Dates:
October 1, 2013
30 sep-2013
29 sep-2013
28 sep-2013
27 sep-2013
26 sep-2013
Try:
SQL > SELECT sysdate-7 + LEVEL FROM DUAL
2. CONNECT BY LEVEL<=>=>
3 * ORDER BY 1 DESC
SQL > /.
SYSDATE-LEVEL 7 +.
-----------------------------
October 1, 2013 13:04:52
30 - Sep - 2013 13:04:52
29 - Sep - 2013 13:04:52
28 - Sep - 2013 13:04:52
27 - Sep - 2013 13:04:52
26 - Sep - 2013 13:04:52
25 - Sep - 2013 13:04:52
7 selected lines.
-
SQL query to get the dates between two dates
Hello
We have a chart with start date and end date... Now I need to get all the dates between the start date and end date...
Table looks to below...
Create the table date_table (start_date, end_date date);
The table data will be as below:
start_date end_date
January 1, 2013 January 4, 2013
February 1, 2013 February 3, 2013
............... .................
............... ..................
............... .................
May 1, 2013 may 3, 2013
I want a result like below...
holiday_dates
January 1, 2013
January 2, 2013
January 3, 2013
January 4, 2013
February 1, 2013
February 2, 2013
February 3, 2013
.................
.................
.................
.................
May 1, 2013
May 2, 2013
May 3, 2013
Can anyone help... ?
Ramesh9158 wrote:
Hello
Your query will not work for our case...
First... We do not know the number of rows in the table... If we cannot use the union...
Second... hard coding of dates... but we do not know what could be that goes back in the table... it could be no matter what it takes not only as appearing to the interpreter...
Hey riri.
My code will work everywhere I use with with union all statement to create the example data.
Try the query:
-The main query
Select d1 + row_number() over (partition by iden) - stopped by iden holiday 1
Of
connect by level<= d2="" -="" d1="" +="">=>
and prior iden iden =
and prior sys_guid() is not null
----
Ramin Hashimzade
-
Need a sql script loader to load data into a table
Hello
IM new to Oracle... Learn some basic things... and now I want the steps to do to load the data from a table dump file...
and the script for sql loader
Thanks in advance
Hello
You can do all these steps for loading data...
Step 1:
Create a table in Toad to load your data...
Step 2:
Creating a data file... Create your data file with column headers...
Step 3:
Creating a control file... Create your control file to load the data from the table data file (there is a structure of control file, you can search through the net)
Step 4:
Move the data file and the control file in the path of the server...
Step 5:
Load the data into the staging table using sql loader.
sqlldr control =
data = connect as: username/password@instance.
-
Compare and get the data in the tables (see post for details)
I have two tables TableA and TableB. I struggle to write a query to get the dates of TableB (instead of TableA dates) where TableA dates don't coincide with the tableB (beginning and end).
Example 1: For account A1234,.
TableA got 2 rows 1/31/2014-3/3/2014 (which corresponds to TableB row), but TableA got another rank 31/01/2014 - 31/01/2014 that corresponds with the date of TableB Begin. In this case, I'm looking for output as below,
Use TableB start and end date and combine number two rows from TableA for this account
ACCOUNT TableB_BEGIN TableB_END AMOUNT A1234 31/01/2014 03/03/2014 100.0000000000 Example 2: For the B7777 account.
TableA end date aligns with the end dates of TableB for this account, in this case I want out put as,.
Use TableB start and end date and get the amount of TableA
ACCOUNT TableB_BEGIN TableB_END AMOUNT B7777 05/04/2013 06/05/2013 200.0000000000 Example 3: On behalf of D5555,.
Even a TableA line corresponds with TableA, there are two other rows in TableA matching start date with TableA and correspondence with the end date with TableA, in this case, that I put as,.
Use TableB start and end date and combine number three rows from TableA for this account.
ACCOUNT TableB_BEGIN TableB_END AMOUNT D5555 08/08/2014 10/09/2014 1100.0000000000 Example 4: To account E6666.
Table corresponds to a row with TableB and no additional lines in TableA, just display the data in A table
Tables and data:
create table TableA ( Account varchar2(10) not null, Begin date not null, End date not null, Amount number(19,10) not null ) ; create table TableB ( Account varchar2(10) not null, Begin date not null, End date not null, Amount number(19,10) not null ) ; TableA Data: insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('31-01-2014', 'dd-mm-yyyy'), 0.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('B7777', to_date('18-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 120.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('C6666', to_date('25-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('16-08-2014', 'dd-mm-yyyy'), 1000.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 0.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('16-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tablea (ACCOUNT, BEGIN, END, AMOUNT) values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000); TableB Data: insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('B7777', to_date('05-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 200.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('C6666', to_date('06-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 1100.0000000000); insert into tableb (ACCOUNT, BEGIN, END, AMOUNT) values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000); SELECT A.ACCOUNT, A.BEGIN, A.END, A.AMOUNT, B.ACCOUNT, B.BEGIN, B.END, B.AMOUNT FROM TABLEA A LEFT JOIN TABLEB B ON A.ACCOUNT = B.ACCOUNT
Hello
SeshuGiri wrote:
Hi Frank,.
Your query/solution works very well, but I forgot to mention something in the first post...
Please insert these additional lines and try the request again.
TableA Additional lines:
- Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
- values ('F9999', to_date (January 2, 2014 ',' dd-mm-yyyy ""), to_date (3 January 2014 ', 'dd-mm-yyyy'), 999.0000000000);
- Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
- values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);
TableB Additional lines:
- Insert into TABLEb (ACCOUNT, BEGIN, END, QUANTITY)
- values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);
Question 1:
The table has a rows for A1234 account (i.e. the time period different than the ranks for the same account)
one is A1234 31/01/2014-03/03/2014, A1234 03/03/2014-03/04/2014
Your query that returns two rows for A1234 account (which is what I want), but the amount is messed up.
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 1100 2 A1234 03/03/2014 03/04/2014 1100 Except:
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 101 2 A1234 03/03/2014 03/04/2014 999 Question 2:
In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?
I don't get the results with additional data. I get 1099 for two lines where account = 'A1234 '. I get 1100 as the amount on the line with the account = "D5555. You did it other changes to data?
Except:
ACCOUNT BEGIN END TOTAL_AMOUNT 1 A1234 31/01/2014 03/03/2014 101 2 A1234 03/03/2014 03/04/2014 999 Still, I don't see why you want to 101 for the amount of the first row. Why not 100?
How can you know which rows from tablea should get attached to what rows from tableb, when the account is not unique?
Maybe you want something like this:
SELECT a.account
b.begin
b.end
SUM (a.amount) AS total_amount
FROM tablea a
ON a.account = b.account JOIN tableb B
AND a.begin BETWEEN b.begin
AND b.end
AND a.end BETWEEN b.begin
AND b.end
GROUP OF a.account, b.begin, b.end
ORDER BY a.account
;
but I guess just to your needs, and guessing is not a very good or reliable way to solve problems.
Question 2:
In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?
Yes, it looks that you want an outer join. What happened when you tried? As always, post your code, the exact results you want from the given sample data, as well as an explanation of how you get these results from these data.
-
Get the data in the table in the format of number
Ive got this table with numbers in it, that I want to use for some simple calculations, but I get the message that the data in the table is not a number:
The whole is in a loop for, with teller1 as in ascending order.
code:
var xco:Array = [180,233,271,292,292,270,231,179,124,74,34,11,9,30,70,121];
var yco:Array = [11,33,73,124,181,232,270,290,291,271,234,183,125,72,33,11];for (var teller1 = 1; teller1 < 33; teller1 ++) {}
var ringsegment_mc:Ring_1 = new Ring_1();
ringsegment_mc.x = XCO [teller1] + kernplaats;
ringsegment_mc.y = yco [teller1] + kernplaats;
ringsegment_mc.addEventListener (Event.ENTER_FRAME, vernietig);
addChild (ringsegment_mc);
{Switch (teller1)}
box 16:
kernplaats = Math.Random () * 600 + 300;
kernplaats = Number (400);
trace (yco [teller1]);
trace (yco [teller1] + kernplaats);
}
}If the trace functions are:
undefined
NaN
so I tried to use this:
trace (yco [3]);
trace (yco [3] + kernplaats);who gave this:
124
524
If something goes wrong in trying to read the table, but what? and how can it be solved.
I don't know what you're after, but if you want to use the same loop twice, then put it inside another loop... (Note that arrays start at index 0, not 1)
for (var i = 0; i)<2;>2;>
for (var teller1 = 0; teller1<16; teller1++)="">16;>
var ringsegment_mc:Ring_1 = new Ring_1();
ringsegment_mc.x = XCO [teller1] + kernplaats;
ringsegment_mc.y = yco [teller1] + kernplaats;
ringsegment_mc.addEventListener (Event.ENTER_FRAME, vernietig);
addChild (ringsegment_mc);
{Switch (teller1)}
box 16:
kernplaats = Math.Random () * 600 + 300;
kernplaats = Number (400);
trace (yco [teller1]);
trace (yco [teller1] + kernplaats);
}
}}
-
get the data in the table of the image in pixels
Ma, I have an array of image which I am using gerargb() method now in the table there are data, but how do I get the particular pixel data how this table to store image. Hitesh gs
If your image is 20 * 10 - 20 pixels wide and 10 pixels tall, so you have a 20 * 10 == 200 input array.
Pixels are numbered from the top left corner. If the index
0 - is the upper left corner
199 - is the lower right corner,
(x * 20) + y--is the pixel x (x is in the range 0 through 9) online, column y (there is in the range 0-19. Do not forget that this countdown of the top left corner.
Claire?
-
SQL question to get a top customer of the page
Hi all
I'm prasanna. I have a question about SQL, to get a customer based on name of the year and the customer. I wrote the request like this. But I got an error.
Select calendar_year, cust_first_name, max (sum (amount_sold)) in sale, the time the customers where sales.cust_id = customers.cust_id and times.time_id = sales.time_id of the calendar_year group, cust_first_name
The error is like this:
* Error from the 1 in the command line:
Select calendar_year, cust_first_name, max (sum (amount_sold)) in sale, the time the customers where sales.cust_id = customers.cust_id and times.time_id = sales.time_id of the calendar_year group, cust_first_name
Error in the command line: 1 column: 7
Error report:
SQL error: ORA-00937: not a function of simple-group
00937 00000 - 'not a single-group function. "
* Cause:
Action:
Thank you inadvace
Kind regards
Prasanna865016 wrote:
Your response, I had only one top customer with year, name of the client, amount_sold. But I need for each yearselect calendar_year, cust_first_name, total_amount_sold max_amount_sold from ( select calendar_year, cust_first_name, sum(amount_sold) total_amount_sold, row_number() over(partition by calendar_year order by sum(amount_sold) desc) rn from sales, times, customers where sales.cust_id=customers.cust_id and times.time_id=sales.time_id group by calendar_year, cust_first_name ) where rn = 1 /
I will give you a single customer by calendar_year.
SY.
-
How to get the data in the table if the date is less - than two months from the current date?
Hi all
I have a requirement in to retrieve table data. If any of the basic date in the column data.
I have a date field (expiration date) I need to display data which expires two months.
Please give me a solution.
Concerning
Shankar
Hi, Shankar,
Sorry, we don't know what you want.
If you want something which, when executed on March 13, 2014, finds all the lines where expires and is located between March 13, 2014 and may 13, 2014, inclusive,
SELECT *- or whatever the columns that you want to
FROM table_x
WHERE expire > = TRUNC (SYSDATE)
Maturity AND< add_months="" (trunc="" (sysdate)="" ,="" 2)="" +="">
;
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
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: https://forums.oracle.com/message/9362002
-
How do I get the data in a table column of material using the tcp/ip interface
Hello everyone, I want to get my material data using tcp /ip interface.and and then display them in a column of the table control? can any body tell how to do that .that me clear I never before communicate with hardware so please help me in detail.
Thank you
Hi Charlotte,.
ask that 'someone' for more specific information.
You must know the exact format of the channels you receive in order to analyze!
-
GET A DATE THE TARGET TABLE MAX
Hello friends,
Can someone tell me how to extract the date max of the target table.
Thank you.Azhar
Sorry why again once you are not able to use the aggregator operator to get a max value. You don't need a group of when taking a max value what from a table, unless otherwise specified
Try it with a simple table b table card
table (several itemno)
table b (number maxitem)
Use aggregator and don't put anything in the section of owb agg transformation group. Generate the code and take a look
-
Export all the objects and only some data in the table
Hello
can we use exclude and include them both at the same time. I want to export the full scheme, but only a few required data table 5, it is possible.
Please share expdp and impdp query.
Regs,
Brijesh845712 wrote:
Hellocan we use exclude and include them both at the same time. I want to export the full scheme, but only a few required data table 5, it is possible.
Please share expdp and impdp query.
Regs,
BrijeshYou can export meta_data first and then export the tables you want to get data.
exp hr/hr rows=N file=xxxxxxxxxxx.dmp exp hr/hr file=yyyyyyyyyyy.dmp tables=(emp,dep)
complete schema without data first and then import data
imp hr/hr file=xxxxxxxxxxx.dmp imp hr/hr file=yyyyyyyyyyy.dmp IGNORE=y (so it will load data to previously created tables)
concerning
Gokhan Atil
Maybe you are looking for
-
Pls help me to remove my video on yesterday 12 some time I was getting scam by here 300rm if not it will be shared at my member family and post on YouTube
-
Cannot use bluetooth &; wifi in my hp 14-d002tx
I use Windows 7 Ultimate edition. But I have no drivers bluetooth & wifi for this operating system. Please suggest me the driver names and where I could find these drivers. Help, please.
-
Can I install Windows 7 in VMware or any other virtual machine?
I tried, but I get an error 0 x professional 80070570 during installation of Windows 7 in VMware. I'm installing with an ISO file I downloaded from http://www.mydigitallife.info/download-windows-7-iso-official-32-bit-and-64-bit-direct-download-links/
-
missing or corrupted ntfs.sys file
I get a message that my ntfs.sys file is missing or damaged. It tells me to insert the original installation cd, however, I don't have the original installation cd. What can I do to restore this file and my computer?
-
When setting in development mode Simulator a screen showing an IP address where the two first two tokens are attached to the 169.254 and there are som of choice for the next two chips. This IP address does not appear to be a report any with the IP ad