I'm trying to write a procedure that displays customerID, customer name, product name, and the total quantity of products the customer purchased, and the total amount the customer paid.Here's the relevant Schema tables:
Now I'm trying to wrap the above query in procedure code. I believe that I need a cursor, but I don't know what kind of cursor variable to store the result of the SELECT statement in because the query selects columns from several different tables, and I'm not sure how to terminate the FOR loop (but I think probably I can use the EXIT WHEN cursor%NOTFOUND;Here's the procedure code I have written thus far:
CREATE OR REPLACE PROCEDURE find_customer_statistics IS DECLARE TYPE cust_stats IS REF CURSOR; weak ref cursor declaration
SELECT sales_order.customer_id, customer.name, product.description, SUM(line_item.quantity), SUM(line_item.subtotal) FROM sales_order, customer, product, line_item WHERE customer.customer_id = sales_order.customer_id AND line_item.order_id = sales_order.order_id [code]....
how to design the ERD for Rental Management like I want know how to design tables to check every month's rent. Is there any way to store month and year with out day in database?
MY requirment is: I want the first three nullable attributes. For Eg: If I have 60 columns in table, I need to fetch the first three null data in a row.
SELECT customers.custid AS CUSTID, customers.memberid AS MEMBERID, customers.bname AS BNAME, drpepper_rebate.drpepid AS DRPEPID, drpepper_rebate.totalcarb AS TOTALCARB, drpepper_rebate.totalncb AS TOTALNCB,
[code]....
I have more then 700 customer records in the Customers table, but so far I can only pull 500 records.
Reason I am trying to pull all the records from the customer table is because I want to find out who is missing cokeid and Drpepid.
I'm doing online business of selling my manufacturing product to my customer through internet. It is so much easy way but with this there are some unwanted threads that might be disturb business working area. I want to keep my customer online data from hacker but have no strong software who minimize or protect them hackers.
i have also another concern as per below xml file.
My requirement is to identify perticular node ,whose having PriorValue attribute present in <pi:the Actual_Comp_Change> tag,those record should return.
i WANTED TO SIMPLIFY THIS CODE SO THAT I NEED NOT DO ALL THESE manipulations but still get the result of UNI_CUG_SITE,
Create Table CUG_SITE compress nologging As Select C_Key, S_Key From A group by C_Key, S_Key / commit / --Creating a table for all Single Sited Customer --- [code]........
the more customers we have for our software solution the more individual oracle objects (Tables, Packages, Functions, etc.) we have in our scheme. Right now we separate these by giving them identifying names like "X_CUSTOMER1_TABLENAME" e.g. (I know ..... )
This is not very practical when keeping our reference clean and when deploying/syncing our reference with a customer db: One customer would receive the objects of other customers on a deploy.
Is there a common solution to this problem? We were thinking about having a separate scheme for each customer. That way we would have our standard, untouched scheme with the basic functionality and the customer schemes with the individual content.
To make it a bit more concrete: We have around 100 basic tables that make the most of the content/functionality of the software. Each customer might have between 1 -5 additional tables with "custom" data that is used in conjunction with the standard objects in individual packages, functions etc. The installations will be made on our customers systems. So I have in mind to have schemes 0001, 0002, etc for each customer IN OUR REFERENCE. But we would then deploy only the scheme for that certain user when installing on their system. So for example for customer 0001 I would deploy the STANDARD and 0001 scheme
i'm working on procedure to send invoices to customer thru mails.
i'm using UTL_Mail package to send html content in a mail , it's working if i'm using my company mail exchange BUT if i put "xxxx@hotmail.com" or "xxxx@yahoo.com" it doesn't work and raise
error :ORA-29279: SMTP permanent error: 550 5.7.1 Unable to relay for xxxxx@hotmail.com
have a column cstomer_ts from table customer, which contain records like:
"cstomer account"||"PRIVATE"||"foundation" "cstomer account"||"PRIVATE"||"foundation of money" "cstomer account"||"PRIVATE"||"Moneycost"now i want to fetch the third record from the column cstomer_ts which starts with 'Foundation'
i mean i want to fetch only 3rd postion frm the column cstomer_ts and tht should starts with 'Foundation'
He had created an object type and wanted to populate it in a query. So far so good. But then he wanted to select some attributes from that object in the same query. Basically, he wanted to do something like this:
With his_view As ( select object_type( attr1, attr2) theobj From his_table Where ... ) Select theobj.attr1 From his_view
But somehow he was hitting ORA-00904: "THEOBJ"."ATTR1": invalid identifier over and over again.Here's a test script:
Create type mhe_type As Object( col1 Number , col2 Varchar2(30) ) / -- Basic select With mhe_view [code]...
Specify a correlation name, which is alias for the table, view, materialized view, or subquery for evaluating the query. This alias is required if the select list references any object type attributes or object type methods. link...
The requirement is to find the last date when either ATTRIB1 or ATTRIB2 were modified for each ID. There are many other columns in the table, but I'm not interested in other columns.
Test Case
SET LINES 100 SET PAGES 100 DROP TABLE test_log / CREATE TABLE test_log
[code]....
Expected Output
ID LAST_CHANGE_DATE ---------- -------------------- 11 02-SEP-2012 10:58:32 35 05-AUG-2012 10:58:32
I have written the below query, to get the required output.
SELECT MAX(i_date) last_change_date FROM ( SELECT seq,id, attrib1, attrib2, i_date, row_number() OVER (PARTITION BY attrib1 ORDER BY i_date) rn1, row_number() OVER (PARTITION BY attrib2 ORDER BY i_date) rn2
I have created a pl sql type as object with five attributes as below.Now im trying to insert only 3 attributes with the attribute names ( As like insert into statement with column names).
Create type address_test as object ( Streetno varchar2(20), Locality varchar2(20), City varchar2(20), Pin varchar2(7), Country varchar2(20)) [code]....
Is that possible to use attribute names in the insert statement of column object type ?
How to Print Customer Copy / Office Copy in rports 6i for example i want to print two copies of any report i want that on first copy of report shows CUSTOMER COPY and second copy of shows OFFICE COPY and report may be on multiple pages.
I am student of Oracle programming(SQL).Has a question on MIN and MAX functions:
- "Write a SELECT statement that returns one row for each customer with four columns--the customer's first and last name, the date of the customer's most recent order, and the date of the customer's oldest order and the difference between the two dates. Sort the result set so the customers who have been ordering with the company the longest appear first. Use most recent order date as a tie-breaker for the sort."
where orders and order_details,customers are 3 different.this is my query ...but its not working.
SELECT DISTINCT customers.customer_first_name||' '||customers.customer_last_name AS Customer_name,MAX(order_date) AS "Most recent order", MIN(order_date) AS "Oldest order" FROM customers INNER JOIN orders ON customers.customer_id=orders.customer_id LEFT JOIN order_details ON orders.order_id=order_details.order_id LEFT JOIN items ON order_details.item_id=items.item_id ORDER BY Customer_name
how to write this in sql command lineDisplay CUSTOMER number, name, rep, balance, and credit limit for all CUSTOMERs of Rep 20.
In addition, display this information for CUSTOMERs of rep 65 who have a $10,000 credit limit. Arrange the output by credit limit descending within rep ascending. no more than two decimal digits
I need to incorporate a count of the number of units from TableG that have a certain status. I tried the following but when I tried to run it, I get an error saying that it's not a Group By expression -the red part is highlighted in TOAD.
select B.desc "Location", F.desc "Source", A.amt "Amount", sum(G.G_CNT) "No. Units", (select count(*) from TableG G2 where G2.D_ID = D.ID and G2.status = 10 group by G2.D_ID)"Count", c.desc "Status" [code]....
Any thoughts how I can incorporate a query in my select of attributes?how to Group By something.
I'm using the odp.net type factory (class IOracleCustomType and the specific annotations...) to map udts to c# classes.By now I had no problems with it, because I've never used "ref" attributes within the udts.Now I need the use of "ref" attributes within udts but it seems that the odp factory cannot handle those references.
For example:_*
A Simple Type: create or replace type bookcontent_t force as object ( id number(20) , name varchar2(1000) );*And a collection with references to objects of this type:*
create or replace type fms_bookcontent_ref_cln force as table of *ref* bookcontent_t;The c# class is generated by odp.net.
When I retrieve data by using odp.net I get a collection with the correct number of elements but the values are null.What can I do to solve this problem with "ref" attributes/lists? How can I get the referenced object instances?
I have data in point cloud (x,y,z,a,b,c,d (a,b,c,d are some attributes about this point)). i create a point cloud (sdo_pc - geometry), block tables (sdo_geometry - geometry). if i use a function to_geometry, result is only in multi point without attributes. it is way display this 3D data, and at the same time inquire of concerning for a attributes in concrete points?
I have created two types and a list of the first type:
create type type1; / create type type1_list as table of ref type1; / create type type2; /
I have now just created the two types as follows:
create type type1 as object( id# number ); / create type type2 as object( attribute1 type1_list, MEMBER FUNCTION function1 RETURN NUMBER ); /
Ok, I've created the tables (I don't know if it's necessary to point out my problem)
CREATE TABLE type1_table OF type1; / CREATE TABLE type2_table OF type2 NESTED TABLE attribute1 STORE AS nested_type1_list_table; /
And what I wanted to do now is to implement the member function1 and check something of the attributes of type1 in the list of attribute1... And that's where my question occurs, how does it work, I can't figure it out. I tried something like this:
Quote: create or replace TYPE BODY type2 AS MEMBER FUNCTION function1 RETURN NUMBER AS
In statspack I find a lot of wait events "ARCH wait on SENDREQ". The database is configured with the LGWR ASYNC attribute. In the documentation I can read that the "ARCH wait"-events may happen in case the database is configured with the ARCH attribute.How is it possible I get these "ARCH wait"-envents and do these wait events have any effect on the "on line" performance of the database? Is it possible that a user that saves data in the database has to wait for thest "ARCH wait"-events?
Whenever there is a change in the c_flag, we need to identify the change and do some processing. How do I identify the change from either 1 to 0 or 0 to 1. The change can be either way. The point of importance is to identify the change.
CREATE TABLE tab1 ( id NUMBER(10) NOT NULL, description VARCHAR2(50) NOT NULL, Start_Date DATE, id_num NUMBER(10), c_flag varchar2(2)); [code]....