I need the number of unique customers which buy product "7" per month.
Product Customer Date
7 A 22.07.2013
7 A 22.07.2013
7 A 22.07.2013
1 B 23.10.2013
1 A 20.07.2013
7 C 23.07.2013
7 C 23.07.2013
11 D 30.07.2013
1 C 30.10.2013
1 E 01.11.2013
11 C 04.11.2013
My first move: SELECT Product, Customer, Date FROM TABLE WHERE Product = '7' AND Date BETWEEN StartDate AND EndDate
The communication table has around 1 billion rows which is partitioned by a date column which is not used in the query. The hierarchy table has only 10000 rows. rewrite the query if its possible.Its trying to find the count of customers[distinct] which are in the same campaign.
select h.brand_cd, h.campaign_name, h.campaign_start_dt, h.campaign_name,h.campaign_desc,h.subject, count(distinct cc.customer_id) from communication cc,hierarchy h where cc.campaign_hierarchy_id = h.campaign_hierarchy_id and h.brand_cd in ('ABY','AYO') AND H.CAMPAIGN_OWNER = 'WONDER' and h.campaign_start_dt >'1-JUL-2011' group by h.brand_cd, h.campaign_name, h.campaign_start_dt, h.campaign_desc,h.subject;
I am soon engaging in a project where we will deploy three triggers to each table in a customers live database. One each for Inserts,Updates and deletes.
These triggers write or update a row in a separate table on a different schema.
We have experienced locking issues on these tables previously with SQL Server. Are there settings we can look at to improve performance?
what I want my code to do is display the customers who live in either Georgia or Florida who recently placed an order totaling more than $80.
My code so far:
SELECT LastName, FirstName, SUM(Retail * Quantity) AS Total From CUSTOMERS, ORDERS, ORDERITEMS, BOOKS Where (State = 'FL' OR State = 'GA') Group by customers.customer# Having SUM(Retail * Quantity) > 80.00;
Insert into rent(customer_id) values (1); Insert into rent(customer_id) values (2); Insert into rent(customer_id) values (3); Insert into rent(customer_id) values (4); [code]...
Now my requirement is i need to assign doc_num from doc_id table to 4 customers in rent table randomly. I mean update doc_num in rent table from doc_id table randomly. how to write update statement.
i want to replace 4 digit number in a given string with the same number incremented by 10000.
That mean in the given sting 1201 should be replace by 11201 (Icremented BY 10000).
Input String:
<query><matchAll>true</matchAll><row><columnId>1201</columnId><dataType>31</dataType><op>Like</op><val>North America - Houston</val></row><row><columnId>1212</columnId><dataType>31</dataType><op>!=</op><val>Agreement Date Mismatch</val></row><row><columnId>1212</columnId><dataType>31</dataType><op>!=</op><val>Facility Type Mismatch</val></row><row><columnId>1224</columnId><dataType>31</dataType><op>Like</op><val>y</val></row></query>
Required output :
<query><matchAll>true</matchAll><row><columnId>11201</columnId><dataType>31</dataType><op>Like</op><val>North America - Houston</val></row><row><columnId>11212</columnId><dataType>31</dataType><op>!=</op><val>Agreement Date Mismatch</val></row><row><columnId>11212</columnId><dataType>31</dataType><op>!=</op><val>Facility Type Mismatch</val></row><row><columnId>11224</columnId><dataType>31</dataType><op>Like</op><val>y</val></row></query>
I have a text field and if the text field has 5 consecutive numbers then I have to extract the number and the previous character from where the 5digit number starting
For example i/p asdfasfsdS251432dasdasd o/p should be S251432
I have the following select query that works perfectly fine. Returns 25 rows based on the descending order of the price.But, I want add one more expression to this list of columns in this query (apart from customer_id).
the expression should look like Cust-01 for the first customer from the below query all the way to Cust-25 for the last customer.But how can I can generate 01 to 25 in oracle?
select customer_id from (select customer_id from capitalPLAN where member_status = 'MEMBER' AND customer_id NOT in ('156','201','1385','2125','3906','165') order by price desc ) where rownum <= 25
my column type is NUMBER(10,0) ,it accept the input value from text field I using TO_NUMBER(?) to insert value into table, is the a way to handle if the input is 'aaaaaaaaaa' not digit?
Quote:drop table p; create table p (qty number(3), beg_no number(5)); insert into p values(5, 110); insert into p values(8, 786);
drop table s;
create table s (used_no number(5)); insert into s values(111); insert into s values(113); insert into s values(791);
Table p: it has ticket quantity and ticket begining number. Thus according to first record ticket number will begin at 110 and will end at 110+5 (Beg_no +qty). According to second record ticket number will begin at 786 and will end at 786+8 (Beg_no +qty). This table can have many records.
Table s: it has ticket numbers which are sold. The ticket will always be any number from table and will lay in any record in this format between beg_no and beg_no+qty
Note that serial number must reset after each 4 lot_num againt dpt_num. Not that where lot is associated in associated_with_lot there serial number must be same as serial number is for associated lot.
But i want to reset rownum after each 4. Mean after serial number 4 , serail number must start from 1. I want to reset serial number after each 4 records (lot_num) against dpt_num;
I have a table datatype number (12,10) that I am reading out of. I am taking the value from this source table and inserting it into a destination table of datatype number (12,15).
I do not have the ability to alter the tables. How can i convert this number so i can insert. I am currently getting the error "ORA-01438: value larger than specified precision allowed for this column"
I am trying to use the to_number, but it not working. How can i format this number field so i can read it from source where i have number (12,10) and insert it successfully in a higher precision table of number(12,15)
I'm trying to find a way to see if a value occurs more than once in a string. I just need to know "T/F", or "Y/N", etc.
The string will be comma delimited.
String: '1,2,3,1' Ans: "T"
String: '1,2,3,4' Ans: "N"
They do need to match exactly. for instance
String: '1,2,3,1a' Ans: "N"
Using some code I found on this site, I coded this but I'm sure there's a better way. Is there??
--Check for Duplicate combination row values BEGIN --Query will split the string into individual pieces. --Group the pieces to see if any 2 rows are the same --If no rows are the same then "no_data_found" exception is thrown SELECT 'T' INTO vResult
In our production, we have two nodes in the cluster. We use the sequence for one of the main table for primary key. Our application is expecting sequence number increments along with created date time stamp. Right now sequences are cached for each node and it creates problem for the application. We would not like to use NOCACHE option because it causes performance issue.
This is the current scenario -
Transaction #1 on Node 1 - Seq ID 1 - Time Stamp 12:01 Transaction #2 on Node 2 - Seq ID 51 - Time Stamp 12:02 Transaction #3 on Node 1 - Seq ID 2 - Time Stamp 12:03
When I try to query based on the time stamp, primary should also go up. To be very clear on what I would like to have, please consider the following example.Without using NOCACHE option, I need to have the data in the following order.
Transaction #1 on Node 1 - Seq ID 1 - Time Stamp 12:01 Transaction #2 on Node 2 - Seq ID 2 - Time Stamp 12:02 Transaction #3 on Node 1 - Seq ID 3 - Time Stamp 12:03
In other words, sequence number should always increment along with the time.
Is it possible to get a CSI number for individuals ?
i would like to have access to Metalink documents and access to any patchset updates. I know Oracle database is available for free downloads, but the version available is 11.2.0.1, patchset update is available to paid customers having CSI#.
How to obtain a CSI#. i am willing to pay and get a valid registration as an individual and not as a company.
I am using ROWNUM pseduo column in one of the queries after using partition clause (analytic function, not table partition). The query is working fine in oracle 9i(9.2.0.8) but the same query didn't work as expected in Oracle 11g.
Environment: OS: UNIX AIX 5.3 DB: Oracle 11.2.0.1
Is there any difference in using ROWNUM in these versions?
how can I select whole table in parts of 100 rows?
If I have primary key I can:
CODEstart=0; end=100; select * from table where ID>=start_point and ID<end; start=end; end=end+100; and repeat: CODEselect * from table where ID>=start_point and ID<end;
How can I do it without primary key? Is there another posibility to getting 100 number of rows? Maybe using rowid?