Datapump_Data_filter subquery trouble
Hi All,
I'm having trouble getting a subquery into an export. I am trying to only export data from a table based on data held in another control table and have the subquery below. Single row simple queries work fine, but as soon as i start to use subqueries it get the error message below. I scanned around various sites and i seem to be doing the same thing as most other people so i can't see why its not working. Any help/advice would be much appreciated.
I am using Release 10.2.0.3.0 on a windows environment.
declare
h1 NUMBER;
begin
h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'TABLE', job_name => 'EXPORT000178', version => 'COMPATIBLE');
dbms_datapump.set_parallel(handle => h1, degree => 1);
dbms_datapump.add_file(handle => h1, filename => 'EXPDAT.LOG', directory => 'DIRECTORY', filetype => 3);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''DEVELOPMENT'')');
dbms_datapump.metadata_filter(handle => h1, name => 'NAME_EXPR', value => 'IN(''HISTORICDATA'', ''ARCHIVECONTROL'')');
dbms_datapump.add_file(handle => h1, filename => 'EXPDATHISTORIC.DMP', directory => 'DIRSANGHA', filetype => 1);
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.data_filter(handle => h1, name => 'SUBQUERY', value => 'where exists (select sampleref, hist_date
from archivecontrol where HISTORICDATA.uniqueref = ARCHIVECONTROL.uniqueref)', table_name =>'HISTORICDATA');
dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.detach(handle => h1);
end;Thanks.
G
I got the same error...got here looking for the solution...here's the solution to my problem
Same errors
Error at line 1
ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 2926
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3162
ORA-06512: at line 10
Turns out that these are MIS-directional messages. The real error message appeared in the LOG file. Googling and metalink were not helpful on the above ORA codes.
From the Log file
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "/u01/dba/refresh/SMARTT/EXport _tables.DMP"
ORA-27038: created file already exists
Additional information: 1
ORA-39012: Client detached before the job started.
So the solution is to change the name of the dump or remove the dump.
Here's the dbms_datapump doc for future reference: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_datpmp.htm#BABDECJE
From the dbms_datapump doc
Adds files to a Data Pump job. Three types of files may be added to jobs: Dump files to contain the data that is being moved, log files to record the messages associated with an operation, and SQL files to record the output of a SQL_FILE operation. Log and SQL files will overwrite previously existing files. Dump files will never overwrite previously existing files. Instead, an error will be generated.
mondo
Edited by: mondo on Nov 3, 2009 10:29 AM
Similar Messages
-
Trouble with subquery and rownum and ordering
I'm having trouble making this subquery work. The basic idea is that the web app will show only so many rows of results on the page, but right now I'm just playing around in SQL*Plus. The address book holds mixed case, so in order to sort by name properly I need to use UPPER to ignore case sensitivity. This SQL statement works fine for me:
select addressbookid from addressbook where addressbookid like '905430931|%' order by upper(addressbookid);I know that if you mention ROWNUM in the WHERE clause, you're referring to the row numbers of the ResultSet that Oracle returns. How do I use both ORDER BY UPPER(ADDRESSBOOKID) and WHERE ROWNUM > 25 AND ROWNUM <= 50? I figured a subquery would do it, but I can't write a correct one that does it! Below are my 2 attempts with the errors, and then I just tried to play with rownum:
SQL> select addressbookid from addressbook where addressbookid in (select addressbookid from address book where addressbookid like '905430931|%' order by upper(addressbookid));
select addressbookid from addressbook where addressbookid in (select addressbookid from addressbook
ERROR at line 1:
ORA-00907: missing right parenthesis
SQL> select addressbookid from addressbook where addressbookid in upper(select addressbookid from addressbook where addressbookid like '905430931|%');
select addressbookid from addressbook where addressbookid in upper(select addressbookid from address
ERROR at line 1:
ORA-00936: missing expression
SQL> select addressbookid from addressbook where addressbookid like '905430931|%' and rownum > 25 and rownum <= 50 order by upper(addressbookid);
no rows selected
SQL> select addressbookid from addressbook where addressbookid like '905430931|%' and rownum > 25 and rownum <= 50;
no rows selectedLike I said, if I can get a working subquery, then I'd like to attach that restriction on the rownum stuff. I'm wondering if it will be a problem trying to get the ordering to happen and then the rownum restriction after that, and all in the same query...
Btw, we've made all the table and column names in our database uppercase, so that shouldn't matter.This is probably the most efficient way ...
select addressbookid
from
select addressbookid,
rownum rn
from
select addressbookid
from addressbook
where addressbookid like '905430931|%'
order by addressbookid
where rownum <= 50
where rn > 25 -
Trouble updating multiple rows in table using subquery
Hi everyone, I'm having trouble updating multiple rows with a subquery. Here's the setup:
create table mytable (
col_a number primary key,
col_b number,
col_c number,
col_d number);
insert into mytable values (1 ,1,1,15);
insert into mytable values (2 ,1,2,7 );
insert into mytable values (3 ,1,3,11);
insert into mytable values (4 ,1,4,23);
insert into mytable values (5 ,1,5,14);
insert into mytable values (6 ,2,1,50);
insert into mytable values (7 ,2,2,41);
insert into mytable values (8 ,2,3,13);
insert into mytable values (9 ,2,4,12);
insert into mytable values (10,2,5,19);
insert into mytable values (11,3,1,10);
insert into mytable values (12,3,2,92);
insert into mytable values (13,3,3,81);
insert into mytable values (14,3,4,17);
insert into mytable values (15,3,5,66);
insert into mytable values (16,4,1,54);
insert into mytable values (17,4,2,41);
insert into mytable values (18,4,3,22);
insert into mytable values (19,4,4,24);
insert into mytable values (20,4,5,17);For this example, using an update statement (or merge if that's better), say I want to set the values for col_d where col_b = 3 equal to the values for col_d where col_b = 1 and col_c equal each other. Results should look like the following after the update:
col_a col_b col_c col_d
1 1 1 15
2 1 2 7
3 1 3 11
4 1 4 23
5 1 5 14
6 2 1 50
7 2 2 41
8 2 3 13
9 2 4 12
10 2 5 19
11 3 1 15
12 3 2 7
13 3 3 11
14 3 4 23
15 3 5 14
16 4 1 54
17 4 2 41
18 4 3 22
19 4 4 24
20 4 5 17I can see it right there at my fingertips using this query, where I want to set b_col_d = a_col_d, but I'm missing something, as this query returns too many rows when used in the update statement.
select * from (
select col_a as a_col_a, col_b as a_col_b, col_c as a_col_c, col_d as a_col_d
from mytable
where col_b = 1
) a, (
select col_a as b_col_a, col_b as b_col_b, col_c as b_col_c, col_d as b_col_d
from mytable
where col_b = 3
) b
where a.a_col_c = b.b_col_cupdate mytable set column_d = (select ??? where exists ???)
Can someone help me get there? I'm using 10GR2.
Thanks!
MarkHopefully this is what you are looking for:
SQL > UPDATE mytable myt1
2 SET col_d = ( SELECT myt2.col_d
3 FROM mytable myt2
4 WHERE myt2.col_b = 1
5 AND myt1.col_c = myt2.col_c
6 )
7 WHERE col_b = 3
8 AND EXISTS
9 ( SELECT NULL
10 FROM mytable myt2
11 WHERE myt2.col_c = myt1.col_c
12 )
13 ;
5 rows updated.
SQL > SELECT * FROM mytable ORDER BY col_a;
COL_A COL_B COL_C COL_D
1 1 1 15
2 1 2 7
3 1 3 11
4 1 4 23
5 1 5 14
6 2 1 50
7 2 2 41
8 2 3 13
9 2 4 12
10 2 5 19
11 3 1 15
12 3 2 7
13 3 3 11
14 3 4 23
15 3 5 14
16 4 1 54
17 4 2 41
18 4 3 22
19 4 4 24
20 4 5 17
20 rows selected.Thank you so much for providing the sample data in an easy to consume form, as well as the expected output. -
I've been working on a query for homework that I'm very close to getting the desired result, but I'm having trouble finessing the last bit.
"Write a query to display the brand ID, brand name, brand type, and average price of products for the brand that has the largest average product price."
I am able to get the largest average price, but I'm having trouble tacking on the ID, name, and type. Grasping at straws now. My outer query needs adjusting.
Using Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production.
SELECT BRAND_ID, BRAND_NAME, BRAND_TYPE, "AVGPRICE"
FROM LGBRAND
WHERE "AVGPRICE" IN
SELECT MAX("AVGPRODPRICE") AS "AVGPRICE"
FROM
SELECT B.BRAND_ID, B.BRAND_NAME, B.BRAND_TYPE,
ROUND(AVG(P.PROD_PRICE), 2) AS "AVGPRODPRICE"
FROM LGBRAND B, LGPRODUCT P
WHERE P.BRAND_ID = B.BRAND_ID
GROUP BY B.BRAND_ID, B.BRAND_NAME, B.BRAND_TYPE
);Tables and Values...
CREATE TABLE lgbrand (
brand_id NUMBER(4,0) NULL,
brand_name VARCHAR2(100) NULL,
brand_type VARCHAR2(20) NULL
CREATE TABLE lgproduct (
prod_sku VARCHAR2(15) NOT NULL,
prod_descript VARCHAR2(255) NULL,
prod_type VARCHAR2(255) NULL,
prod_base VARCHAR2(255) NULL,
prod_category VARCHAR2(255) NULL,
prod_price NUMBER(10,2) NULL,
prod_qoh NUMBER(10,0) NULL,
prod_min NUMBER(10,0) NULL,
brand_id NUMBER(4,0) NULL
--Insert data
--LGBRAND
INSERT INTO LGBRAND VALUES (23, 'FORESTERS BEST', 'VALUE');
INSERT INTO LGBRAND VALUES (33, 'BINDER PRIME', 'PREMIUM');
INSERT INTO LGBRAND VALUES (25, 'STUTTENFURST', 'CONTRACTOR');
INSERT INTO LGBRAND VALUES (35, 'LE MODE', 'PREMIUM');
INSERT INTO LGBRAND VALUES (27, 'HOME COMFORT', 'CONTRACTOR');
INSERT INTO LGBRAND VALUES (28, 'OLDE TYME QUALITY', 'CONTRACTOR');
INSERT INTO LGBRAND VALUES (29, 'BUSTERS', 'VALUE');
INSERT INTO LGBRAND VALUES (30, 'LONG HAUL', 'CONTRACTOR');
INSERT INTO LGBRAND VALUES (31, 'VALU-MATTE', 'VALUE');
INSERT INTO LGBRAND VALUES (24, 'REGAL HOME', 'VALUE');
INSERT INTO LGBRAND VALUES (26, 'HOMESTEADER FINEST', 'PREMIUM');
INSERT INTO LGBRAND VALUES (32, 'YOUR HOME HELPER', 'VALUE');
INSERT INTO LGBRAND VALUES (34, 'PRIME OF LIFE', 'VALUE');
--LGPRODUCT
INSERT INTO LGPRODUCT VALUES ('2366-EFV', 'Varnish, Interior, Polyurethane, Oil Modified, Gloss', 'Interior', 'Solvent', 'Top Coat', 6.59, 3, 25, 30);
INSERT INTO LGPRODUCT VALUES ('8841-JFP', 'Varnish, Interior, Polyurethane, Oil Modified, Satin', 'Interior', 'Solvent', 'Top Coat', 6.59, 30, 35, 25);
INSERT INTO LGPRODUCT VALUES ('7231-UES', 'Stain, Interior, for Concrete Floors', 'Interior', 'Solvent', 'Top Coat', 23.99, 50, 10, 30);
INSERT INTO LGPRODUCT VALUES ('8726-ZNM', 'Floor Paint, Alkyd, Low Gloss ', 'Exterior', 'Solvent', 'Top Coat', 21.99, 107, 15, 29);
INSERT INTO LGPRODUCT VALUES ('8543-RJN', 'Floor Paint, Alkyd, Low Gloss ', 'Interior', 'Solvent', 'Top Coat', 21.99, 10, 5, 31);
INSERT INTO LGPRODUCT VALUES ('3754-MAK', 'Floor Paint, Latex, Low Gloss ', 'Exterior', 'Water', 'Top Coat', 21.99, 70, 10, 33);
INSERT INTO LGPRODUCT VALUES ('1504-LVK', 'Floor Paint, Latex, Low Gloss ', 'Interior', 'Water', 'Top Coat', 21.99, 63, 25, 33);
INSERT INTO LGPRODUCT VALUES ('2200-DAI', 'Primer Sealer, Low Permeability, Latex, Interior', 'Interior', 'Water', 'Primer', 7.59, 66, 5, 31);
INSERT INTO LGPRODUCT VALUES ('6491-XKF', 'Fire Retardant Coating, Interior, Clear (ULC Approved)', 'Interior', 'Solvent', 'Top Coat', 32.99, 27, 25, 29);
INSERT INTO LGPRODUCT VALUES ('5541-HST', 'Fire Retardant Coating, Interior, Clear (ULC Approved)', 'Interior', 'Water', 'Top Coat', 32.99, 31, 15, 35);
INSERT INTO LGPRODUCT VALUES ('5508-OUB', 'Fire Retardant Coating, Alkyd, Interior, Flat (ULC Approved)', 'Interior', 'Solvent', 'Top Coat', 35.99, 56, 35, 29);
INSERT INTO LGPRODUCT VALUES ('1203-AIS', 'Fire Retardant Coating, Latex, Interior, Flat (ULC Approved)', 'Interior', 'Water', 'Top Coat', 35.99, 49, 25, 35);
INSERT INTO LGPRODUCT VALUES ('5437-WBO', 'Fire Retardant Sealer, Alkyd, Interior (ULC Approved)', 'Interior', 'Solvent', 'Top Coat', 28.99, 26, 30, 35);
INSERT INTO LGPRODUCT VALUES ('9838-FUF', 'Fire Retardant Top-Coat, Clear, Alkyd, Interior (ULC Approved)', 'Interior', 'Solvent', 'Top Coat', 29.99, 137, 25, 27);
INSERT INTO LGPRODUCT VALUES ('6257-AGA', 'Fire Retardant Top-Coat, Latex, Interior (ULC Approved)', 'Interior', 'Water', 'Top Coat', 29.99, 127, 30, 27);
INSERT INTO LGPRODUCT VALUES ('5516-FYH', 'Floor Paint, Latex, Gloss ', 'Exterior', 'Water', 'Top Coat', 21.99, 82, 15, 27);
INSERT INTO LGPRODUCT VALUES ('7532-PYJ', 'Floor Paint, Latex, Gloss ', 'Interior', 'Water', 'Top Coat', 21.99, 76, 40, 25);
INSERT INTO LGPRODUCT VALUES ('3503-FGI', 'Primer, Bonding, Solvent Based', 'Exterior', 'Solvent', 'Primer', 5.59, 87, 25, 33);
INSERT INTO LGPRODUCT VALUES ('3061-DOI', 'Primer, Bonding, Solvent Based', 'Interior', 'Solvent', 'Primer', 5.59, 100, 15, 33);
INSERT INTO LGPRODUCT VALUES ('5220-JDO', 'Acrylic Coating, High Build, for Pavement Marking', 'Exterior', 'Solvent', 'Top Coat', 36.99, 109, 10, 29);
INSERT INTO LGPRODUCT VALUES ('3716-WZD', 'Acrylic Coating, High Build, for Pavement Marking', 'Interior', 'Solvent', 'Top Coat', 36.99, 132, 10, 23);
INSERT INTO LGPRODUCT VALUES ('4241-UOF', 'Varnish, Polyurethane, Moisture Cured, Flat (MPI Gloss Level 1)', 'Exterior', 'Solvent', 'Top Coat', 13.59, 49, 40, 27);
INSERT INTO LGPRODUCT VALUES ('9393-RFA', 'Varnish, Polyurethane, Moisture Cured, Flat (MPI Gloss Level 1)', 'Interior', 'Solvent', 'Top Coat', 13.59, 51, 25, 30);
INSERT INTO LGPRODUCT VALUES ('5602-QBF', 'Polyurethane, Two-Component, Pigmented, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 4.29, 13, 40, 30);
INSERT INTO LGPRODUCT VALUES ('2410-SKH', 'Polyurethane, Two-Component, Pigmented, Gloss (MPI Gloss Level 6)', 'Interior', 'Solvent', 'Top Coat', 4.29, 26, 20, 27);
INSERT INTO LGPRODUCT VALUES ('2932-PBS', 'Varnish, Interior, Flat ', 'Interior', 'Solvent', 'Top Coat', 13.59, 61, 15, 35);
INSERT INTO LGPRODUCT VALUES ('1078-QXL', 'Varnish, Interior, Semi-Gloss ', 'Interior', 'Solvent', 'Top Coat', 14.59, 94, 40, 23);
INSERT INTO LGPRODUCT VALUES ('8988-FDW', 'Primer, Alkyd, Quick Dry, for Metal', 'Exterior', 'Solvent', 'Primer', 11.99, 110, 30, 28);
INSERT INTO LGPRODUCT VALUES ('1150-MMR', 'Primer, Alkyd, Quick Dry, for Metal', 'Interior', 'Solvent', 'Primer', 11.99, 44, 10, 35);
INSERT INTO LGPRODUCT VALUES ('3343-DJU', 'Epoxy, Gloss', 'Exterior', 'Solvent', 'Top Coat', 7.79, 56, 25, 25);
INSERT INTO LGPRODUCT VALUES ('8751-IOK', 'Epoxy, Gloss', 'Interior', 'Solvent', 'Top Coat', 7.79, 19, 10, 25);
INSERT INTO LGPRODUCT VALUES ('8495-ZQR', 'Varnish, Aliphatic Polyurethane, Two-Component', 'Exterior', 'Solvent', 'Top Coat', 12.29, 111, 40, 23);
INSERT INTO LGPRODUCT VALUES ('9413-EHI', 'Varnish, Aliphatic Polyurethane, Two-Component', 'Interior', 'Solvent', 'Top Coat', 12.29, 101, 5, 33);
INSERT INTO LGPRODUCT VALUES ('5445-XOY', 'Primer, Alkyd, Anti-Corrosive for Metal', 'Exterior', 'Solvent', 'Primer', 10.99, 66, 25, 31);
INSERT INTO LGPRODUCT VALUES ('7258-HCV', 'Primer, Alkyd, Anti-Corrosive for Metal', 'Interior', 'Solvent', 'Primer', 10.99, 30, 35, 35);
INSERT INTO LGPRODUCT VALUES ('9064-IWN', 'Primer, Vinyl Wash', 'Exterior', 'Solvent', 'Primer', 7.59, 15, 5, 33);
INSERT INTO LGPRODUCT VALUES ('8523-UCB', 'Alkyd, Quick Dry, Semi-Gloss', 'Exterior', 'Solvent', 'Top Coat', 21.59, 139, 10, 30);
INSERT INTO LGPRODUCT VALUES ('9138-QCV', 'Alkyd, Quick Dry, Semi-Gloss', 'Interior', 'Solvent', 'Top Coat', 21.59, 107, 15, 28);
INSERT INTO LGPRODUCT VALUES ('6249-NDN', 'Epoxy Deck Coating (Slip-Resistant)', 'Exterior', 'Solvent', 'Top Coat', 22.59, 131, 30, 30);
INSERT INTO LGPRODUCT VALUES ('1854-AFJ', 'Epoxy Deck Coating (Slip-Resistant)', 'Interior', 'Solvent', 'Top Coat', 22.59, 98, 40, 30);
INSERT INTO LGPRODUCT VALUES ('2046-RUS', 'Polyurethane Deck Coating (Slip-Resistant)', 'Exterior', 'Solvent', 'Top Coat', 25.99, 137, 35, 28);
INSERT INTO LGPRODUCT VALUES ('8053-PME', 'Polyurethane Deck Coating (Slip-Resistant)', 'Interior', 'Solvent', 'Top Coat', 25.99, 28, 25, 25);
INSERT INTO LGPRODUCT VALUES ('5161-GIZ', 'Lacquer, Sanding Sealer, Clear', 'Exterior', 'Solvent', 'Sealer', 13.99, 17, 30, 31);
INSERT INTO LGPRODUCT VALUES ('8894-LUR', 'Lacquer, Sanding Sealer, Clear', 'Interior', 'Solvent', 'Sealer', 13.99, 79, 40, 27);
INSERT INTO LGPRODUCT VALUES ('7762-STV', 'Lacquer, Clear, Satin', 'Interior', 'Solvent', 'Top Coat', 14.99, 56, 35, 29);
INSERT INTO LGPRODUCT VALUES ('8400-JDC', 'Lacquer, Clear, Gloss', 'Interior', 'Solvent', 'Top Coat', 14.99, 49, 25, 31);
INSERT INTO LGPRODUCT VALUES ('4784-SLU', 'Lacquer, Clear, Flat', 'Interior', 'Solvent', 'Top Coat', 14.99, 14, 15, 30);
INSERT INTO LGPRODUCT VALUES ('3943-HFA', 'Shellac', 'Exterior', 'Solvent', 'Top Coat', 11.99, 16, 35, 27);
INSERT INTO LGPRODUCT VALUES ('1143-RGX', 'Shellac', 'Interior', 'Solvent', 'Primer', 11.99, 116, 15, 27);
INSERT INTO LGPRODUCT VALUES ('2217-JOH', 'Dry Fall, Alkyd, (eggshell-like - MPI Gloss Level 3)', 'Interior', 'Solvent', 'Top Coat', 13.59, 43, 5, 29);
INSERT INTO LGPRODUCT VALUES ('1200-KBU', 'Stain, Semi-Transparent, for Interior Wood', 'Interior', 'Solvent', 'Top Coat', 20.99, 91, 20, 25);
INSERT INTO LGPRODUCT VALUES ('1747-XNI', 'Paste, Wood Filler', 'Exterior', 'Solvent', 'Filler', 3.99, 85, 30, 33);
INSERT INTO LGPRODUCT VALUES ('3274-XJX', 'Paste, Wood Filler', 'Interior', 'Solvent', 'Filler', 3.99, 37, 35, 25);
INSERT INTO LGPRODUCT VALUES ('4667-JLN', 'Danish Oil', 'Interior', 'Solvent', 'Cleaner', 3.49, 79, 15, 35);
INSERT INTO LGPRODUCT VALUES ('4491-GNC', 'Alkyd, Exterior, Semi-Gloss (MPI Gloss Level 5)', 'Exterior', 'Solvent', 'Top Coat', 21.99, 132, 25, 28);
INSERT INTO LGPRODUCT VALUES ('8685-REM', 'Primer, Quick Dry, for Aluminum', 'Exterior', 'Solvent', 'Primer', 19.99, 66, 25, 30);
INSERT INTO LGPRODUCT VALUES ('9133-OXA', 'Primer, Quick Dry, for Aluminum', 'Interior', 'Solvent', 'Primer', 19.99, 89, 20, 30);
INSERT INTO LGPRODUCT VALUES ('8338-JZU', 'Alkyd, Quick Dry, Gloss', 'Exterior', 'Solvent', 'Top Coat', 17.99, 118, 40, 28);
INSERT INTO LGPRODUCT VALUES ('2143-VQX', 'Alkyd, Quick Dry, Gloss', 'Interior', 'Solvent', 'Top Coat', 17.99, 8, 10, 35);
INSERT INTO LGPRODUCT VALUES ('3610-RKR', 'Traffic Marking Paint, Latex', 'Exterior', 'Water', 'Top Coat', 18.59, 123, 10, 27);
INSERT INTO LGPRODUCT VALUES ('6358-UST', 'Traffic Marking Paint, Latex', 'Interior', 'Water', 'Top Coat', 18.59, 102, 40, 33);
INSERT INTO LGPRODUCT VALUES ('6626-ROK', 'Epoxy, High Build, Gloss', 'Exterior', 'Solvent', 'Top Coat', 13.59, 10, 10, 29);
INSERT INTO LGPRODUCT VALUES ('1403-TUY', 'Sealer, Water Based, for Concrete Floors', 'Interior', 'Water', 'Sealer', 42.99, 56, 5, 29);
INSERT INTO LGPRODUCT VALUES ('9688-ZUX', 'Linseed Oil, Boiled', 'Exterior', 'Solvent', 'Cleaner', 12.99, 67, 15, 30);
INSERT INTO LGPRODUCT VALUES ('3585-MCJ', 'Linseed Oil, Boiled', 'Interior', 'Solvent', 'Cleaner', 12.99, 129, 15, 27);
INSERT INTO LGPRODUCT VALUES ('7551-ZVS', 'Primer, Epoxy, Anti-Corrosive, for Metal', 'Exterior', 'Solvent', 'Primer', 14.99, 15, 10, 31);
INSERT INTO LGPRODUCT VALUES ('1099-WFZ', 'Primer, Epoxy, Anti-Corrosive, for Metal', 'Interior', 'Solvent', 'Primer', 14.99, 57, 40, 35);
INSERT INTO LGPRODUCT VALUES ('1336-FVM', 'Alkyd, Sanding Sealer, Clear', 'Interior', 'Solvent', 'Sealer', 23.29, 54, 25, 33);
INSERT INTO LGPRODUCT VALUES ('4072-SWV', 'Sealer, Solvent Based, for Concrete Floors', 'Exterior', 'Solvent', 'Sealer', 20.59, 86, 10, 23);
INSERT INTO LGPRODUCT VALUES ('3701-YAW', 'Sealer, Solvent Based, for Concrete Floors', 'Interior', 'Solvent', 'Sealer', 20.59, 109, 15, 30);
INSERT INTO LGPRODUCT VALUES ('8439-KUP', 'Vinyl, High Build', 'Exterior', 'Solvent', 'Top Coat', 17.99, 76, 5, 33);
INSERT INTO LGPRODUCT VALUES ('2262-NBI', 'Vinyl, High Build', 'Interior', 'Solvent', 'Top Coat', 17.99, 113, 5, 31);
INSERT INTO LGPRODUCT VALUES ('7883-NLQ', 'Primer, Rust-Inhibitive, Water Based', 'Interior', 'Water', 'Primer', 12.59, 29, 25, 23);
INSERT INTO LGPRODUCT VALUES ('5781-TKY', 'Epoxy, High Build, Low Gloss', 'Exterior', 'Solvent', 'Top Coat', 13.59, 81, 35, 29);
INSERT INTO LGPRODUCT VALUES ('9569-WMK', 'Epoxy, High Build, Low Gloss', 'Interior', 'Solvent', 'Top Coat', 13.59, 65, 15, 29);
INSERT INTO LGPRODUCT VALUES ('5140-RTG', 'Fire Resistant Sealer, for Exterior Wood (ULC Approved)', 'Exterior', 'Solvent', 'Sealer', 19.99, 107, 40, 35);
INSERT INTO LGPRODUCT VALUES ('9484-UTK', 'Varnish, Fire Retardant (ULC Approved), Exterior', 'Exterior', 'Solvent', 'Top Coat', 17.99, 129, 20, 30);
INSERT INTO LGPRODUCT VALUES ('2996-VMO', 'Multicolor Coating', 'Interior', 'Solvent', 'Top Coat', 23.59, 32, 25, 27);
INSERT INTO LGPRODUCT VALUES ('4465-QHD', 'Multicolor Coating', 'Interior', 'Water', 'Top Coat', 23.59, 3, 5, 29);
INSERT INTO LGPRODUCT VALUES ('4518-GHU', 'Elastomeric, Pigmented, Exterior, Water Based, Flat', 'Exterior', 'Water', 'Top Coat', 21.99, 36, 35, 31);
INSERT INTO LGPRODUCT VALUES ('7658-HCW', 'Latex, Interior, Gloss (MPI GLoss Level 6)', 'Interior', 'Water', 'Top Coat', 19.99, 15, 25, 27);
INSERT INTO LGPRODUCT VALUES ('5290-HTG', 'Epoxy-Modified Latex, Interior, Gloss (MPI Gloss Level 6)', 'Interior', 'Water', 'Top Coat', 21.59, 119, 25, 27);
INSERT INTO LGPRODUCT VALUES ('8436-MGP', 'Block Filler, Epoxy', 'Exterior', 'Solvent', 'Filler', 7.79, 84, 10, 28);
INSERT INTO LGPRODUCT VALUES ('4626-LJU', 'Block Filler, Epoxy', 'Interior', 'Solvent', 'Filler', 7.79, 82, 35, 28);
INSERT INTO LGPRODUCT VALUES ('2896-OZJ', 'Water Repellant, Clear (Not Paintable)', 'Exterior', 'Solvent', 'Top Coat', 23.99, 70, 5, 23);
INSERT INTO LGPRODUCT VALUES ('3955-NWD', 'Water Repellant, Clear (Not Paintable)', 'Interior', 'Water', 'Top Coat', 23.99, 130, 15, 30);
INSERT INTO LGPRODUCT VALUES ('2407-SUX', 'Dry Fall, Latex, Flat', 'Interior', 'Water', 'Top Coat', 9.89, 143, 15, 23);
INSERT INTO LGPRODUCT VALUES ('1198-STR', 'Latex, Exterior, Gloss (MPI Gloss Level 6)', 'Exterior', 'Water', 'Top Coat', 23.59, 45, 15, 28);
INSERT INTO LGPRODUCT VALUES ('2384-PGY', 'Epoxy, High Build, Self Priming, Low Gloss', 'Exterior', 'Solvent', 'Top Coat', 29.99, 133, 35, 30);
INSERT INTO LGPRODUCT VALUES ('9355-MNT', 'Epoxy, High Build, Self Priming, Low Gloss', 'Interior', 'Solvent', 'Top Coat', 29.99, 73, 35, 23);
INSERT INTO LGPRODUCT VALUES ('3393-AZQ', 'Top-Coat for Multicolored Coating, Clear', 'Exterior', 'Water', 'Top Coat', 35.99, 132, 5, 25);
INSERT INTO LGPRODUCT VALUES ('3215-VIP', 'Top-Coat for Multicolored Coating, Clear', 'Interior', 'Solvent', 'Top Coat', 35.99, 44, 20, 35);
INSERT INTO LGPRODUCT VALUES ('2699-GNS', 'Top-Coat for Multicolored Coating, Clear', 'Interior', 'Water', 'Top Coat', 35.99, 59, 40, 27);
INSERT INTO LGPRODUCT VALUES ('8094-EYX', 'Lacquer, Pigmented, Satin', 'Interior', 'Solvent', 'Top Coat', 14.59, 50, 40, 27);
INSERT INTO LGPRODUCT VALUES ('9858-XUM', 'Lacquer, Pigmented, Semi-Gloss', 'Interior', 'Solvent', 'Top Coat', 14.59, 72, 35, 29);
INSERT INTO LGPRODUCT VALUES ('9671-NYZ', 'Lacquer, Pigmented, Gloss', 'Interior', 'Solvent', 'Top Coat', 14.59, 51, 5, 30);
INSERT INTO LGPRODUCT VALUES ('1485-NNI', 'Primer Sealer, for Multicolor Systems', 'Interior', 'Water', 'Primer', 18.99, 76, 10, 30);
INSERT INTO LGPRODUCT VALUES ('9408-WNM', 'Fire Retardant Top-Coat, Exterior, Low Sheen (ULC Approved)', 'Exterior', 'Solvent', 'Top Coat', 21.99, 86, 15, 30);
INSERT INTO LGPRODUCT VALUES ('6109-ZZO', 'Deck Coating, Latex, Exterior', 'Exterior', 'Water', 'Top Coat', 32.89, 63, 40, 23);
INSERT INTO LGPRODUCT VALUES ('4200-FTI', 'Varnish, Water Based, Clear, Satin', 'Interior', 'Water', 'Top Coat', 14.59, 7, 5, 30);
INSERT INTO LGPRODUCT VALUES ('9686-HQV', 'Varnish, Water Based, Clear, Semi-Gloss', 'Interior', 'Water', 'Top Coat', 15.29, 73, 25, 35);
INSERT INTO LGPRODUCT VALUES ('8909-SPD', 'Varnish, Water Based, Clear, Gloss', 'Interior', 'Water', 'Top Coat', 15.79, 36, 30, 28);
INSERT INTO LGPRODUCT VALUES ('5379-BLX', 'Dry Fall, Water Based, for Galvanized Steel, MPI Gloss Level 3', 'Interior', 'Water', 'Top Coat', 21.59, 119, 35, 28);
INSERT INTO LGPRODUCT VALUES ('1021-MTI', 'Elastomeric, Exterior, Industrial Grade, Water Based', 'Exterior', 'Water', 'Top Coat', 62.99, 22, 25, 35);
INSERT INTO LGPRODUCT VALUES ('5595-NYE', 'Dry Fall, Water Based, for Galvanized Steel, Flat (MPI Gloss Level 1)', 'Interior', 'Water', 'Top Coat', 23.99, 24, 25, 30);
INSERT INTO LGPRODUCT VALUES ('7355-WBT', 'Primer, Galvanized, Water Based', 'Interior', 'Water', 'Primer', 13.59, 62, 30, 31);
INSERT INTO LGPRODUCT VALUES ('3035-NHD', 'Primer, Galvanized, Non-Cementitious', 'Exterior', 'Solvent', 'Primer', 15.69, 37, 30, 29);
INSERT INTO LGPRODUCT VALUES ('4481-SGY', 'Primer, Galvanized, Non-Cementitious', 'Interior', 'Solvent', 'Primer', 15.69, 90, 10, 27);
INSERT INTO LGPRODUCT VALUES ('2833-LIV', 'Primer, Stain Blocking', 'Exterior', 'Solvent', 'Primer', 32.99, 129, 15, 35);
INSERT INTO LGPRODUCT VALUES ('2857-NDO', 'Primer, Stain Blocking', 'Interior', 'Solvent', 'Primer', 32.99, 87, 40, 28);
INSERT INTO LGPRODUCT VALUES ('4045-HUC', 'Primer, Stain Blocking, Water Based', 'Interior', 'Water', 'Primer', 29.99, 100, 10, 30);
INSERT INTO LGPRODUCT VALUES ('5213-YTB', 'Latex, Interior, High Performance Architectural, (velvet-like - MPI Gloss Level 2)', 'Interior', 'Water', 'Top Coat', 34.49, 15, 35, 31);
INSERT INTO LGPRODUCT VALUES ('1580-VCE', 'Latex, Interior, High Performance Architectural, (eggshell-like - MPI Gloss Level 3)', 'Interior', 'Water', 'Top Coat', 34.49, 124, 5, 29);
INSERT INTO LGPRODUCT VALUES ('8207-YYG', 'Latex, Interior, High Performance Architectural, (satin-like - MPI Gloss Level 4)', 'Interior', 'Water', 'Top Coat', 34.49, 14, 15, 35);
INSERT INTO LGPRODUCT VALUES ('4583-VCR', 'Latex, Interior, High Performance Architectural, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Water', 'Top Coat', 34.49, 42, 30, 28);
INSERT INTO LGPRODUCT VALUES ('5413-TTF', 'Latex, Interior, Institutional Low Odor/VOC, Flat (MPI Gloss Level 1)', 'Interior', 'Water', 'Top Coat', 29.99, 71, 5, 27);
INSERT INTO LGPRODUCT VALUES ('9955-WWB', 'Latex, Interior, Institutional Low Odor/VOC, (velvet-like - MPI Gloss Level 2) ', 'Interior', 'Water', 'Top Coat', 29.99, 129, 35, 30);
INSERT INTO LGPRODUCT VALUES ('5060-EDB', 'Latex, Interior, Institutional Low Odor/VOC, (eggshell-like - MPI Gloss Level 3) ', 'Interior', 'Water', 'Top Coat', 29.99, 121, 40, 23);
INSERT INTO LGPRODUCT VALUES ('2351-WVS', 'Latex, Interior, Institutional Low Odor/VOC, (satin-like - MPI Gloss Level 4) ', 'Interior', 'Water', 'Top Coat', 29.99, 89, 5, 30);
INSERT INTO LGPRODUCT VALUES ('4987-BFL', 'Latex, Interior, Institutional Low Odor/VOC, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Water', 'Top Coat', 29.99, 63, 30, 27);
INSERT INTO LGPRODUCT VALUES ('5642-IDA', 'Latex, Interior, Institutional Low Odor/VOC, Gloss (MPI Gloss Level 6)', 'Interior', 'Water', 'Top Coat', 29.99, 39, 10, 35);
INSERT INTO LGPRODUCT VALUES ('4346-GCP', 'Primer Sealer, Interior, Institutional Low Odor/VOC', 'Interior', 'Water', 'Primer', 18.59, 68, 5, 27);
INSERT INTO LGPRODUCT VALUES ('4260-FGB', 'Light Industrial Coating, Interior, Water Based (eggshell-like - MPI Gloss Level 3) ', 'Interior', 'Water', 'Top Coat', 15.59, 97, 40, 35);
INSERT INTO LGPRODUCT VALUES ('7260-YDI', 'Light Industrial Coating, Interior, Water Based, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Water', 'Top Coat', 15.59, 25, 20, 35);
INSERT INTO LGPRODUCT VALUES ('2397-RDX', 'Light Industrial Coating, Interior, Water Based, Gloss (MPI Gloss Level 6)', 'Interior', 'Water', 'Top Coat', 15.59, 6, 10, 30);
INSERT INTO LGPRODUCT VALUES ('2101-WCF', 'Dry Fall, Latex, (eggshell-like - MPI Gloss Level 3)', 'Interior', 'Water', 'Top Coat', 13.99, 60, 10, 30);
INSERT INTO LGPRODUCT VALUES ('7179-YXG', 'Stain, Exterior, Water Based, Semi-Transparent', 'Exterior', 'Water', 'Primer', 12.99, 131, 10, 31);
INSERT INTO LGPRODUCT VALUES ('9857-ESX', 'Alkyd, Water Based, Gloss (MPI Gloss Level 6)', 'Interior', 'Water', 'Top Coat', 25.59, 58, 20, 28);
INSERT INTO LGPRODUCT VALUES ('2553-FSW', 'Dry Fall, Water Based, for Galvanized Steel, MPI Gloss Level 5', 'Interior', 'Water', 'Top Coat', 20.59, 70, 25, 30);
INSERT INTO LGPRODUCT VALUES ('1074-VVJ', 'Light Industrial Coating, Exterior, Water Based (eggshell-like - MPI Gloss Level 3) ', 'Exterior', 'Water', 'Top Coat', 23.29, 43, 25, 25);
INSERT INTO LGPRODUCT VALUES ('1663-CDD', 'Light Industrial Coating, Exterior, Water Based, Semi-Gloss (MPI Gloss Level 5)', 'Exterior', 'Water', 'Top Coat', 23.29, 125, 40, 25);
INSERT INTO LGPRODUCT VALUES ('2233-GJH', 'Light Industrial Coating, Exterior, Water Based, Gloss (MPI Gloss Level 6)', 'Exterior', 'Water', 'Top Coat', 23.29, 41, 25, 33);
INSERT INTO LGPRODUCT VALUES ('5728-ZPO', 'Shop Coat, Quick Dry, for Interior Steel', 'Interior', 'Solvent', 'Sealer', 15.59, 19, 20, 27);
INSERT INTO LGPRODUCT VALUES ('9288-IRF', 'Varnish, Water Based, Clear (eggshell-like) MPI Gloss Level 3', 'Interior', 'Water', 'Top Coat', 14.59, 118, 15, 25);
INSERT INTO LGPRODUCT VALUES ('3516-AGJ', 'Varnish, Exterior, Water Based, (Flat) MPI Gloss Level 1', 'Exterior', 'Water', 'Top Coat', 12.59, 7, 15, 35);
INSERT INTO LGPRODUCT VALUES ('4812-VNN', 'Varnish, Exterior, Water Based, (Velvet-Like) MPI Gloss Level 2', 'Exterior', 'Water', 'Top Coat', 12.99, 42, 40, 27);
INSERT INTO LGPRODUCT VALUES ('4912-YXS', 'Varnish, Exterior, Water Based, (Eggshell-like) MPI Gloss Level 3', 'Exterior', 'Water', 'Top Coat', 12.99, 123, 30, 35);
INSERT INTO LGPRODUCT VALUES ('8199-YRF', 'Varnish, Exterior, Water Based, (Satin-Like) MPI Gloss Level 4', 'Exterior', 'Water', 'Top Coat', 12.99, 105, 10, 33);
INSERT INTO LGPRODUCT VALUES ('7731-GBG', 'Varnish, Exterior, Water Based, (Semi-Gloss) MPI Gloss Level 5', 'Exterior', 'Water', 'Top Coat', 13.39, 109, 35, 35);
INSERT INTO LGPRODUCT VALUES ('2212-MNF', 'Varnish, Exterior, Water Based, (Gloss) MPI Gloss Level 6', 'Exterior', 'Water', 'Top Coat', 13.39, 131, 40, 27);
INSERT INTO LGPRODUCT VALUES ('9276-MVX', 'Varnish, Exterior, Water Based, (High Gloss) MPI Gloss Level 7', 'Exterior', 'Water', 'Top Coat', 13.39, 83, 30, 28);
INSERT INTO LGPRODUCT VALUES ('3298-YFL', 'Primer, Zinc Rich, Moisture Cured', 'Interior', 'Solvent', 'Primer', 13.99, 112, 5, 30);
INSERT INTO LGPRODUCT VALUES ('7006-IXN', 'Polyurethane, Moisture Cured, Pigmented, Intermediate Coat', 'Exterior', 'Solvent', 'Top Coat', 14.99, 53, 35, 29);
INSERT INTO LGPRODUCT VALUES ('1153-AWY', 'Polyurethane, Moisture Cured, Pigmented, Intermediate Coat', 'Interior', 'Solvent', 'Top Coat', 14.99, 116, 20, 28);
INSERT INTO LGPRODUCT VALUES ('2990-BNH', 'Polyurethane, Moisture Cured, Pigmented, Semi-Gloss (MPI Gloss Level 5)', 'Exterior', 'Solvent', 'Top Coat', 16.99, 139, 20, 31);
INSERT INTO LGPRODUCT VALUES ('3258-RVB', 'Polyurethane, Moisture Cured, Pigmented, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Solvent', 'Top Coat', 16.99, 142, 40, 33);
INSERT INTO LGPRODUCT VALUES ('8170-EKF', 'Polyurethane, Moisture Cured, Pigmented, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 16.99, 73, 5, 35);
INSERT INTO LGPRODUCT VALUES ('5734-BGX', 'Polyurethane, Moisture Cured, Pigmented, Gloss (MPI Gloss Level 6)', 'Interior', 'Solvent', 'Top Coat', 16.99, 54, 35, 30);
INSERT INTO LGPRODUCT VALUES ('2870-QZR', 'Floor Coating, Thin Film, for Aircraft Maintenance Facilities', 'Interior', 'Solvent', 'Top Coat', 32.99, 121, 15, 29);
INSERT INTO LGPRODUCT VALUES ('8821-DDM', 'Barrier Coating, Two Coat, Low VOC for Industrial Maintenance', 'Exterior', 'Water', 'Top Coat', 34.99, 103, 40, 35);
INSERT INTO LGPRODUCT VALUES ('3614-PTT', 'Latex, Exterior (MPI Gloss Level 2)', 'Exterior', 'Water', 'Top Coat', 45.99, 21, 5, 25);
INSERT INTO LGPRODUCT VALUES ('3694-XFJ', 'Epoxy-Modified Latex, Interior, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Water', 'Top Coat', 54.89, 39, 25, 27);
INSERT INTO LGPRODUCT VALUES ('5980-BME', 'Primer, Alkali Resistant, Solvent Based', 'Exterior', 'Solvent', 'Primer', 31.99, 23, 30, 25);
INSERT INTO LGPRODUCT VALUES ('2611-QYG', 'Primer, Alkali Resistant, Solvent Based', 'Interior', 'Solvent', 'Primer', 31.99, 81, 5, 29);
INSERT INTO LGPRODUCT VALUES ('6116-NQU', 'Dry Fall, Alkyd, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Solvent', 'Top Coat', 21.99, 15, 35, 27);
INSERT INTO LGPRODUCT VALUES ('1010-MIW', 'Dry Fall, Latex, Semi-Gloss (MPI Gloss Level 5)', 'Interior', 'Water', 'Top Coat', 21.99, 110, 15, 28);
INSERT INTO LGPRODUCT VALUES ('9702-WFX', 'Primer, Quick Dry, for Shop Application to Interior Steel', 'Interior', 'Solvent', 'Primer', 35.49, 134, 5, 35);
INSERT INTO LGPRODUCT VALUES ('2455-ZKN', 'Primer, Epoxy, Water Based, Anti-Corrosive, for Metal', 'Exterior', 'Water', 'Primer', 38.99, 86, 15, 27);
INSERT INTO LGPRODUCT VALUES ('6865-HAO', 'Primer, Epoxy, Water Based, Anti-Corrosive, for Metal', 'Interior', 'Water', 'Primer', 38.99, 127, 25, 29);
INSERT INTO LGPRODUCT VALUES ('6367-AKJ', 'Latex, Recycled (Consolidated), Exterior Flat (G1)', 'Exterior', 'Water', 'Top Coat', 41.99, 103, 20, 23);
INSERT INTO LGPRODUCT VALUES ('3161-XJS', 'Latex, Recycled (Remanufactured), Exterior Flat (G1)', 'Exterior', 'Water', 'Top Coat', 38.99, 61, 5, 29);
INSERT INTO LGPRODUCT VALUES ('7224-FEU', 'Latex, Recycled (Consolidated), Exterior, Low Sheen (G 3-4)', 'Exterior', 'Water', 'Top Coat', 43.99, 94, 35, 27);
INSERT INTO LGPRODUCT VALUES ('2496-QMW', 'Latex, Recycled (Remanufactured), Exterior, Low Sheen (G 3-4)', 'Exterior', 'Water', 'Top Coat', 38.99, 95, 35, 33);
INSERT INTO LGPRODUCT VALUES ('6488-MIG', 'Latex, Recycled (Consolidated), Interior (MPI Gloss Level 2)', 'Interior', 'Water', 'Top Coat', 43.99, 34, 15, 30);
INSERT INTO LGPRODUCT VALUES ('5155-YQL', 'Latex, Recycled (Remanufactured), Interior (MPI Gloss Level 2)', 'Interior', 'Water', 'Top Coat', 38.99, 105, 25, 25);
INSERT INTO LGPRODUCT VALUES ('9126-PWF', 'Latex, Recycled (Consolidated), Interior (MPI Gloss Level 3)', 'Interior', 'Water', 'Top Coat', 48.59, 12, 30, 27);
INSERT INTO LGPRODUCT VALUES ('3933-NSU', 'Latex, Recycled (Remanufactured), Interior (MPI Gloss Level 3)', 'Interior', 'Water', 'Top Coat', 41.99, 105, 10, 33);
INSERT INTO LGPRODUCT VALUES ('6894-JQV', 'Latex, Recycled (Consolidated), Interior (MPI Gloss Level 1)', 'Interior', 'Water', 'Top Coat', 48.59, 35, 5, 27);
INSERT INTO LGPRODUCT VALUES ('4879-AMS', 'Latex, Recycled (Remanufactured), Interior (MPI Gloss Level 1)', 'Interior', 'Water', 'Top Coat', 41.99, 107, 20, 31);
INSERT INTO LGPRODUCT VALUES ('7316-MQD', 'Aluminum Paint', 'Exterior', 'Solvent', 'Top Coat', 12.99, 36, 30, 33);
INSERT INTO LGPRODUCT VALUES ('5046-TTC', 'Aluminum Paint, Heat Resistant (Up to 427°C - 800°F)', 'Exterior', 'Solvent', 'Top Coat', 18.99, 129, 30, 35);
INSERT INTO LGPRODUCT VALUES ('2866-RAM', 'Aluminum Paint, Heat Resistant (Up to 427°C - 800°F)', 'Interior', 'Solvent', 'Top Coat', 18.99, 19, 10, 30);
INSERT INTO LGPRODUCT VALUES ('6596-HOO', 'Primer, Alkali Resistant, Water Based', 'Exterior', 'Water', 'Primer', 9.99, 93, 5, 35);
INSERT INTO LGPRODUCT VALUES ('4812-CMJ', 'Primer, Alkali Resistant, Water Based', 'Interior', 'Water', 'Primer', 9.99, 128, 10, 27);
INSERT INTO LGPRODUCT VALUES ('6350-UPP', 'Block Filler, Latex, Interior/Exterior', 'Exterior', 'Water', 'Filler', 12.49, 119, 5, 25);
INSERT INTO LGPRODUCT VALUES ('6933-YOI', 'Block Filler, Latex, Interior/Exterior', 'Interior', 'Water', 'Filler', 8.99, 34, 15, 29);
INSERT INTO LGPRODUCT VALUES ('9601-ZKZ', 'Primer, Alkyd for Exterior Wood', 'Exterior', 'Solvent', 'Primer', 8.99, 92, 35, 25);
INSERT INTO LGPRODUCT VALUES ('4132-QIN', 'Primer, Oil for Exterior Wood', 'Exterior', 'Solvent', 'Primer', 9.29, 111, 20, 28);
INSERT INTO LGPRODUCT VALUES ('2918-THH', 'Alkyd, Exterior Flat (MPI Gloss Level 1)', 'Exterior', 'Solvent', 'Top Coat', 10.99, 127, 15, 23);
INSERT INTO LGPRODUCT VALUES ('6858-EJW', 'Alkyd, Exterior Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 10.99, 144, 40, 30);
INSERT INTO LGPRODUCT VALUES ('2006-ZBH', 'Latex, Exterior Flat (MPI Gloss Level 1)', 'Exterior', 'Water', 'Top Coat', 10.99, 100, 10, 35);
INSERT INTO LGPRODUCT VALUES ('3488-GSE', 'Latex, Exterior Semi-Gloss (MPI Gloss Level 5)', 'Exterior', 'Water', 'Top Coat', 10.99, 127, 30, 30);
INSERT INTO LGPRODUCT VALUES ('6651-ICK', 'Stain, Exterior, Solvent Based, Semi-Transparent', 'Exterior', 'Solvent', 'Top Coat', 11.99, 141, 30, 33);
INSERT INTO LGPRODUCT VALUES ('7673-ECV', 'Stain, Exterior, Solvent Based, Solid Hide', 'Exterior', 'Solvent', 'Top Coat', 11.99, 122, 15, 25);
INSERT INTO LGPRODUCT VALUES ('1871-GWZ', 'Latex, Exterior, Low Sheen (MPI Gloss Level 3-4)', 'Exterior', 'Water', 'Top Coat', 24.99, 52, 25, 28);
INSERT INTO LGPRODUCT VALUES ('9234-WCQ', 'Stain, Exterior, Water Based, Solid Hide', 'Exterior', 'Water', 'Top Coat', 13.99, 135, 35, 35);
INSERT INTO LGPRODUCT VALUES ('8406-TQG', 'Primer, Bonding, Water Based', 'Interior', 'Water', 'Primer', 7.99, 119, 15, 33);
INSERT INTO LGPRODUCT VALUES ('9624-YLU', 'Primer, Zinc Rich, Organic', 'Exterior', 'Solvent', 'Primer', 11.99, 77, 20, 33);
INSERT INTO LGPRODUCT VALUES ('9324-PPG', 'Primer, Zinc Rich, Organic', 'Interior', 'Solvent', 'Primer', 11.99, 5, 30, 27);
INSERT INTO LGPRODUCT VALUES ('3079-DEG', 'Primer, Zinc Rich, Inorganic', 'Exterior', 'Solvent', 'Primer', 8.99, 28, 25, 35);...continued in my next postingcontinuation of insert values...
INSERT INTO LGPRODUCT VALUES ('7538-ITC', 'Primer, Zinc Rich, Inorganic', 'Interior', 'Solvent', 'Primer', 8.99, 95, 25, 33);
INSERT INTO LGPRODUCT VALUES ('8162-KJI', 'Primer, Zinc Rich, Epoxy', 'Exterior', 'Solvent', 'Primer', 9.49, 73, 10, 31);
INSERT INTO LGPRODUCT VALUES ('9786-DGO', 'Primer, Zinc Rich, Epoxy', 'Interior', 'Solvent', 'Primer', 9.99, 85, 40, 25);
INSERT INTO LGPRODUCT VALUES ('1433-MMY', 'Heat Resistant Coating, (Up to 205°C/402°F), MPI Gloss Level 5-6 ', 'Exterior', 'Solvent', 'Top Coat', 23.99, 129, 10, 27);
INSERT INTO LGPRODUCT VALUES ('2766-EYO', 'Aluminum Paint, High Heat (up to 590° C/1100° F)', 'Exterior', 'Solvent', 'Top Coat', 32.99, 20, 10, 33);
INSERT INTO LGPRODUCT VALUES ('9292-RQZ', 'Aluminum Paint, High Heat (up to 590° C/1100° F)', 'Interior', 'Solvent', 'Top Coat', 32.99, 24, 10, 28);
INSERT INTO LGPRODUCT VALUES ('3528-GBV', 'Primer, Metal, Surface Tolerant', 'Exterior', 'Solvent', 'Primer', 7.49, 34, 35, 31);
INSERT INTO LGPRODUCT VALUES ('6041-PBS', 'Primer, Metal, Surface Tolerant', 'Interior', 'Solvent', 'Primer', 7.49, 53, 30, 25);
INSERT INTO LGPRODUCT VALUES ('3561-LYU', 'Lacquer, Sanding Sealer, White', 'Exterior', 'Solvent', 'Sealer', 3.29, 70, 40, 25);
INSERT INTO LGPRODUCT VALUES ('8937-WVA', 'Lacquer, Sanding Sealer, White', 'Interior', 'Solvent', 'Sealer', 3.29, 12, 30, 28);
INSERT INTO LGPRODUCT VALUES ('4900-YSQ', 'Cleaner, Etching, for Galvanized Metal', 'Exterior', 'Water', 'Cleaner', 4.59, 121, 20, 28);
INSERT INTO LGPRODUCT VALUES ('3384-DML', 'Cleaner, Etching, for Galvanized Metal', 'Interior', 'Water', 'Cleaner', 4.59, 78, 30, 29);
INSERT INTO LGPRODUCT VALUES ('3734-CUQ', 'Primer, Galvanized Metal, Cementitious', 'Exterior', 'Solvent', 'Primer', 14.89, 119, 10, 31);
INSERT INTO LGPRODUCT VALUES ('1067-KBB', 'Primer, Galvanized Metal, Cementitious', 'Interior', 'Solvent', 'Primer', 14.89, 21, 10, 30);
INSERT INTO LGPRODUCT VALUES ('6925-KDN', 'Floor Enamel, Alkyd, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 11.59, 69, 10, 30);
INSERT INTO LGPRODUCT VALUES ('7627-HHI', 'Floor Enamel, Alkyd, Gloss (MPI Gloss Level 6)', 'Interior', 'Solvent', 'Top Coat', 11.59, 128, 40, 28);
INSERT INTO LGPRODUCT VALUES ('9272-LTP', 'Varnish, Marine Spar, Exterior, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 13.29, 87, 35, 27);
INSERT INTO LGPRODUCT VALUES ('5794-JGQ', 'Varnish, with UV Inhibitor, Exterior, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 15.89, 15, 25, 28);
INSERT INTO LGPRODUCT VALUES ('8571-CKP', 'Varnish, Polyurethane, Moisture Cured, Gloss (MPI Gloss Level 6)', 'Exterior', 'Solvent', 'Top Coat', 17.79, 46, 5, 28);
INSERT INTO LGPRODUCT VALUES ('4153-VMO', 'Varnish, Polyurethane, Moisture Cured, Gloss (MPI Gloss Level 6)', 'Interior', 'Solvent', 'Top Coat', 17.79, 30, 25, 33);
INSERT INTO LGPRODUCT VALUES ('1045-DUY', 'Traffic Marking Paint, Alkyd', 'Exterior', 'Solvent', 'Top Coat', 6.59, 10, 40, 35);
INSERT INTO LGPRODUCT VALUES ('8544-CIQ', 'Traffic Marking Paint, Alkyd', 'Interior', 'Solvent', 'Top Coat', 6.59, 16, 25, 35);
INSERT INTO LGPRODUCT VALUES ('2584-CIJ', 'Stain, for Exterior Wood Decks', 'Exterior', 'Solvent', 'Top Coat', 12.39, 17, 10, 30);
INSERT INTO LGPRODUCT VALUES ('4431-LGU', 'Stain, for Exterior Wood Decks', 'Interior', 'Solvent', 'Top Coat', 11.49, 122, 20, 33);
INSERT INTO LGPRODUCT VALUES ('5529-SBL', 'Water Repellent, Clear (Paintable)', 'Exterior', 'Solvent', 'Top Coat', 15.59, 32, 25, 30);
INSERT INTO LGPRODUCT VALUES ('7804-ZVW', 'Water Repellent, Clear (Paintable)', 'Interior', 'Solvent', 'Top Coat', 15.59, 57, 15, 35);
INSERT INTO LGPRODUCT VALUES ('5496-MRA', 'Bituminous Coating', 'Exterior', 'Solvent', 'Top Coat', 28.49, 79, 10, 29);
INSERT INTO LGPRODUCT VALUES ('3036-PCT', 'Sealer, for Knots', 'Exterior', 'Solvent', 'Sealer', 3.99, 65, 5, 25);
INSERT INTO LGPRODUCT VALUES ('4846-BHT', 'Preservative, for Exterior Wood', 'Exterior', 'Solvent', 'Top Coat', 4.49, 88, 40, 33);
INSERT INTO LGPRODUCT VALUES ('5659-BFS', 'Elastomeric Coating, Exterior, Water Based, Non-Flat', 'Exterior', 'Water', 'Top Coat', 17.29, 100, 35, 35);
INSERT INTO LGPRODUCT VALUES ('4976-PZN', 'Primer, Latex, for Interior Wood', 'Interior', 'Water', 'Primer', 13.69, 33, 20, 33);
INSERT INTO LGPRODUCT VALUES ('1838-LZI', 'Latex, Exterior, High Build', 'Exterior', 'Water', 'Top Coat', 12.59, 24, 10, 25);
INSERT INTO LGPRODUCT VALUES ('8310-LAC', 'Textured Coating, Latex, Non-Flat', 'Exterior', 'Water', 'Top Coat', 11.99, 51, 15, 31);
INSERT INTO LGPRODUCT VALUES ('8382-HKN', 'Textured Coating, Latex, Non-Flat', 'Interior', 'Water', 'Top Coat', 11.99, 20, 5, 30);
INSERT INTO LGPRODUCT VALUES ('6249-LYB', 'Textured Coating, Latex, Flat', 'Exterior', 'Water', 'Top Coat', 11.99, 132, 15, 27);
INSERT INTO LGPRODUCT VALUES ('7158-LJP', 'Textured Coating, Latex, Flat', 'Interior', 'Water', 'Top Coat', 11.99, 39, 5, 33);
INSERT INTO LGPRODUCT VALUES ('2379-PCX', 'Latex, Interior, (satin-like - MPI Gloss Level 4)', 'Interior', 'Water', 'Top Coat', 13.59, 77, 15, 25);
INSERT INTO LGPRODUCT VALUES ('5587-MNY', 'Latex, Interior, (velvet-like - MPI Gloss Level 2)', 'Interior', 'Water', 'Top Coat', 14.69, 14, 20, 31);
INSERT INTO LGPRODUCT VALUES ('3594-BYW', 'Primer Sealer, Alkyd, Interior', 'Interior', 'Solvent', 'Primer', 7.39, 80, 15, 27);
INSERT INTO LGPRODUCT VALUES ('4949-VFI', 'Undercoat, Enamel, Interior', 'Interior', 'Solvent', 'Primer', 8.49, 20, 20, 23);
INSERT INTO LGPRODUCT VALUES ('9268-RCB', 'Alkyd, Interior, Semi-Gloss (MPI Gloss Level 5) ', 'Interior', 'Solvent', 'Top Coat', 13.99, 64, 25, 25);
INSERT INTO LGPRODUCT VALUES ('9191-NGA', 'Alkyd, Interior, Gloss (MPI Gloss Level 6) ', 'Interior', 'Solvent', 'Top Coat', 14.99, 88, 35, 29);
INSERT INTO LGPRODUCT VALUES ('5625-FVF', 'Alkyd, Interior, Flat (MPI Gloss Level 1) ', 'Interior', 'Solvent', 'Top Coat', 12.99, 125, 15, 30);
INSERT INTO LGPRODUCT VALUES ('5587-PIP', 'Primer Sealer, Latex, Interior', 'Interior', 'Water', 'Primer', 10.99, 38, 5, 25);
INSERT INTO LGPRODUCT VALUES ('2756-CKP', 'Alkyd, Interior, (eggshell-like - MPI Gloss Level 3) ', 'Interior', 'Solvent', 'Top Coat', 9.99, 10, 40, 28);
INSERT INTO LGPRODUCT VALUES ('9336-MHC', 'Latex, Interior, (eggshell-like - MPI Gloss Level 3) ', 'Interior', 'Water', 'Top Coat', 11.99, 52, 40, 29);
INSERT INTO LGPRODUCT VALUES ('5465-YYG', 'Latex, Interior, Flat (MPI Gloss Level 1)', 'Interior', 'Water', 'Top Coat', 8.99, 115, 30, 29);
INSERT INTO LGPRODUCT VALUES ('2116-PVN', 'Latex, Interior, Semi-Gloss (MPI Gloss Level 5) ', 'Interior', 'Water', 'Top Coat', 12.99, 66, 20, 25);
INSERT INTO LGPRODUCT VALUES ('2129-BCP', 'Dry Fall, Alkyd, Flat', 'Interior', 'Solvent', 'Top Coat', 7.99, 94, 35, 35);
INSERT INTO LGPRODUCT VALUES ('6176-XTX', 'Varnish, Interior, Gloss', 'Interior', 'Solvent', 'Top Coat', 15.59, 117, 30, 33);
INSERT INTO LGPRODUCT VALUES ('2231-OXK', 'Primer, Vinyl Wash', 'Interior', 'Solvent', 'Primer', 7.59, 68, 5, 35);
INSERT INTO LGPRODUCT VALUES ('9175-TAZ', 'Epoxy, High Build, Gloss', 'Interior', 'Solvent', 'Top Coat', 13.59, 15, 40, 27);
INSERT INTO LGPRODUCT VALUES ('2068-TSC', 'Graffiti Protection Top-Coat', 'Exterior', 'Solvent', 'Top Coat', 16.99, 145, 10, 30);
INSERT INTO LGPRODUCT VALUES ('6033-YFY', 'Primer, Stain Blocking, Water Based', 'Exterior', 'Water', 'Primer', 29.99, 140, 20, 28);
INSERT INTO LGPRODUCT VALUES ('5250-JDL', 'Primer, Zinc Rich, Moisture Cured', 'Exterior', 'Solvent', 'Primer', 13.99, 96, 40, 27);
INSERT INTO LGPRODUCT VALUES ('5653-RTU', 'Aluminum Paint', 'Interior', 'Solvent', 'Top Coat', 12.99, 87, 15, 23);
INSERT INTO LGPRODUCT VALUES ('6451-KGJ', 'Primer, Latex for Exterior Wood', 'Exterior', 'Water', 'Primer', 6.99, 117, 30, 35);
INSERT INTO LGPRODUCT VALUES ('7500-ROG', 'Heat Resistant Coating, (Up to 205°C/402°F), MPI Gloss Level 5-6 ', 'Interior', 'Solvent', 'Top Coat', 23.99, 53, 5, 30);
INSERT INTO LGPRODUCT VALUES ('2134-QFE', 'Varnish, with UV Inhibitor, Exterior, Semi-Gloss (MPI Gloss Level 5)', 'Exterior', 'Solvent', 'Top Coat', 15.89, 34, 25, 23);
INSERT INTO LGPRODUCT VALUES ('3716-IWN', 'Epoxy, Quick Set, Mason', 'Exterior', 'Solvent', 'Sealer', 14.99, 75, 20, 28);
INSERT INTO LGPRODUCT VALUES ('1964-OUT', 'Fire Resistant Top Coat, for Interior Wood', 'Interior', 'Solvent', 'Top Coat', 78.49, 120, 10, 30);
INSERT INTO LGPRODUCT VALUES ('8322-JEX', 'Preservative Oil, Gloss', 'Interior', 'Solvent', 'Cleaner', 12.99, 50, 25, 25);output...
BRAND_ID BRAND_NAME BRAND_TYPE AVGPRICE
29 BUSTERS VALUE 22.59 -
Having trouble wrapping query as subquery in order to sum a column
I have a query whose first column in the "select" is something like "count(distinct t.id)", and the query has a "group by" for several columns.
This generates a number of rows with a number in the first column representing the number of distinct id values in the resulting group, and several other columns.
I need to create a modified query that produces the sum of that first column.
I figured this would look something like:
select sum(total) from (select count(distinct t.id) as "total", ... from ... ... where)
I'm not able to get this to work. It appears I can't refer to the alias from the parent query, but I've tried other ways of referencing that column value, and I just can't figure it out.
I'd prefer not to have to provide the original query here. I'm hoping that I've provided enough information that someone could use to give me a useful response.sb92075 wrote:
How do I ask a question on the forums?
SQL and PL/SQL FAQ
Handle: david.karr
Status Level: Pro (560)
Registered: Mar 14, 2003
Total Posts: 911
Total Questions: 67 (50 unresolved)
I extend my condolences to you since you rarely get answers to your questions here.What would be the point of asking easy questions? :) -
Trouble with OR in where clause
Hello,
I'm having trouble with execution speed. The problem seems to be with using OR in my where clause.
Here's the meat of the function where i_pledge_number is an input parm:
BEGIN
SELECT /*+ INDEX (pp) */ SUM(pp.prim_pledge_amount)
INTO return_amount
FROM
primary_pledge pp
WHERE
-- Get total if multiple allocations
pp.prim_pledge_number IN
(SELECT pc.pledge_number
FROM pledge_codes pc
WHERE pc.pledge_code_type = 'M'
AND pc.pledge_code = 'AC'
AND lpad(pc.pledge_comment,10,'0') = i_pledge_number)
-- Get total if single allocation
OR pp.prim_pledge_number = i_pledge_number;
RETURN return_amount;
END;
If I comment out either half of the OR statement (either the subquery or the pp.prim_pledge_number = i_pledge_number half) the function returns a value in .02 seconds. If I leave the OR in, it takes 2.764 seconds to execute?? Can someone please show me a better way (faster) to do this? I tried using nvl() around the subquery but couldn't get it to compile.
ThanksThese things are difficult to diagnose remotely, but here is something you can try....
SELECT */ SUM(pp.prim_pledge_amount)
INTO return_amount
FROM primary_pledge pp
WHERE pp.prim_pledge_number IN (SELECT pc.pledge_number
FROM pledge_codes pc
WHERE pc.pledge_code_type = 'M'
AND pc.pledge_code = 'AC'
AND lpad(pc.pledge_comment,10,'0') = i_pledge_number
UNION ALL
SELECT i_pledge_number FROM dual)
RETURN return_amount;
END;If that doesn't do anything (and it might well not) there are a large number of different ways we can recast this query. To save us further guessing please give us more details: execution plans, database version number, volumetrics.
Cheers, APC -
I have this subquery in a materialized view.
(SELECT COUNT(*)
FROM product_statistics_units psu
INNER JOIN scenes_identity_fact sif
ON (trunc(sif.date_acquired) = trunc(psu.scene_date))
AND ((SELECT satellite_sensor_key
FROM lu_satellite sat
WHERE psu.satellite = sat.satellite
AND psu.sensor_id = sat.sensor_id) = sif.satellite_sensor_key)
AND ((SELECT wrs_key
FROM worldwide_reference_system wwrs
WHERE psu.wrs_path = wwrs.wrs_path
AND wwrs.wrs_row
BETWEEN psu.wrs_starting_row
AND psu.wrs_ending_row) = sif.wrs_key)
WHERE psu.date_unit_shipped IS NOT NULL)
AS times_sold,When I try to create the view, I get this error
ORA-22818: subquery expressions not allowed here
The subquery works fine as a stand-alone query, but when put in the SELECT statement for the materialized view is when I get the error. Also if I comment out the two AND clauses in the join, it works ok.
I am fairly new to oracle and sql, but I have been tasked with creating this materialized view. Any help you guys can give me would be greatly appreciated.Oracle is VERY fussy about what it will/won't allow in materialized view creation. You hit one of the limitations. Try recoding the sub-query as a table join since its doing correlation and see if that works.
Also do not put comments ("--" or " "/* */") in the MV SQL; I've had trouble trying to self-document the SQL in that way. -
Hello!I beg your pardon for my poor English.
Oracle prompts "invalid month" when running the following sentence:
select *
from xtcs xtcs
where xtcs.csmc like '%month'
and (xtcs.cnq,xtcs.csmc) not in (
select distinct
to_char(add_months(to_date((case when substr(yhjf1.pzh,1,2)>='50' then '19' else '20' end)||substr(yhjf1.pzh,1,4),'yyyymm'),-4),'yyyy') pzcnq
,yhjf1.pzhbs||'month'
from yhjf yhjf1
where yhjf1.pzhbs is not null);
But,oracle runs well when running only the subquery in where clause:
select distinct
to_char(add_months(to_date((case when substr(yhjf1.pzh,1,2)>='50' then '19' else '20' end)||substr(yhjf1.pzh,1,4),'yyyymm'),-4),'yyyy') pzcnq
,yhjf1.pzhbs||'month'
from yhjf yhjf1
where yhjf1.pzhbs is not null;
I have checked the data in the table yhjf.And there are some wrong about field pzh which cause oracle wrong .But the where clause 'yhjf1.pzhbs is not null' can filter them out.I'm being in puzzle now.Please tell me why and how I can do.Thanks very much!> Sorry,I'm a Chinese.The names originally were in
Chinese.I converted them into alphabets before posting.
I did not think of that option. I'm glad to hear that the names are meaningful to you :-)
> My data is very large and I had not created a
small data set on which the error happens.
To know what the problem is, you will have to identify the rows that are causing the trouble. Once identified, the solution should be simple.
Regards,
Rob. -
In SO7, when I want to get to my data base files (DBF format, each used chiefly with its form), I press F4. This worked perfectly and still works -- except for a strange new phenomenon. Along with my data bases, a panel of themes also comes up now. I have no use for this and can find no way to stop its popping up. Worse, it comes up also (alone, that is, not with data bases) at times when I have not pressed F4.
user10163784 wrote:
Table D holds raw data. It is roughly 500,000 rows large.
Table M holds matchcodes (things users can enter to identify a raw data row). On the average, there are ca. five matchcodes per raw data row.
The query I need to make moderately efficient is of this type:
select * from D join M on D.identnr = M.identnr
where M.matchcode like 'foo%' and D.f1 > 5 and D.f2 in ('b', 'c', 'n', ' ')
order by D.f3, D.f4
Trouble is, I don't know how.
I suspect the core of the problem is that I need an index over fields that are stored in two separate tables. (Actually I need multiple indexes, since there is roughly a dozen variants of the above SQL required. Oh, and the literal values are bound variables in real life.)
So, the question is, how do I deal with such a situation in Oracle?Consider composite indexes on m.identnr and m.matccode and d.f1 and d.f2.
You don't need any data from M in the result set so perhaps a correlated EXISTS subquery would be effective. Or, perhaps use a WITH clause to read data from M if only a very small percentage of the rows will match 'foo%' to eliminate lots of join candidate rows up front - this might help if you are only reading a small number of rows from M, something like (untested)
with mm as (
select m.identr
from m
where m.matchcode like 'foo%'
select *
from d, mm
where D.identnr = MM.identnr
and D.f1 > 5
and D.f2 in ('b', 'c', 'n', ' ')
order by D.f3, D.f4 -
Access a Connect By Level variable from subquery
With curr_date_details as
select to_date('16-dec-09', 'dd-mon-yy') as businessdate
, trunc( to_date('16-dec-09', 'dd-mon-yy'), 'iw') as bow
, to_date('23-nov-09', 'dd-mon-yy') as bop
, trunc(to_date('23-nov-09', 'dd-mon-yy'),'iy') as boy
, 3 as week_nbr
, 3 as per_week_nbr
, 12 as per_nbr
from dual
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--== Start Date
, case when level <= date_rec.per_week_nbr
then to_date('23-nov-23', 'dd-mon-rr')
when level = date_rec.per_week_nbr + 1
then date_rec.bop
when level = date_rec.per_week_nbr + 2
then date_rec.boy
when level = date_rec.per_week_nbr + 3
then date_rec.boy
end as start_date
--== End Date
, case
when level <= date_rec.per_week_nbr
then to_date('23-nov-23', 'dd-mon-rr') + 6
when level = date_rec.per_week_nbr + 1
then date_rec.bow + 6
when level = date_rec.per_week_nbr + 2
then date_rec.bow + 6
when level = date_rec.per_week_nbr + 3
then date_rec.bop - 1
end as end_date
--=== Dummy Column
, case
when level <= date_rec.per_week_nbr
then ( select 1 + level as t from dual)
else 100
end as pesky_column
from dual mydual
inner join curr_date_details date_rec on date_rec.businessdate = to_date('16-dec-09', 'dd-mon-yy')
connect by level <= date_rec.per_week_nbr + 3gives me error:
Error at Command Line:9 Column:2
Error report:
SQL Error: ORA-01788: CONNECT BY clause required in this query block
01788. 00000 - "CONNECT BY clause required in this query block"
*Cause:
*Action:
How can i access variable from subquery?
this question was taken from another post
Having trouble selecting from a table functionHi,
Using a joiin:
WITH connect_by_query AS
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--=== Dummy Column
, LEVEL AS lvl
, per_week_nbr
from curr_date_details date_rec
connect by level <= date_rec.per_week_nbr + 3
SELECT cb.week_nbr
, case
when cb.lvl <= cb.per_week_nbr
then NVL (sd.sales, 0)
else 100
end as pesky_column
FROM connect_by_query cb
LEFT OUTER JOIN sample_data sd ON sd.datakey = cb.lvl
ORDER BY cb.lvl
;You could also compute week_nbr in the main query, rather than the sub-query.
Using a scalar sub-query:
WITH connect_by_query AS
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--=== Dummy Column
, LEVEL AS lvl
, per_week_nbr
from curr_date_details date_rec
connect by level <= date_rec.per_week_nbr + 3
SELECT week_nbr
, case
when lvl <= per_week_nbr
then NVL ( ( select sales from sample_data where datakey = lvl)
, 0
else 100
end as pesky_column
FROM connect_by_query
ORDER BY lvl
;Notice that the sub-query connect_by_query is the same in both cases. -
I just bought a mini-dvi-to-video adapter so I could use my TV as a display. More specifically, so I could use my VCR to record what's on my Mac's display. I also bought a headphone-to-composite cable adapter. I'm using a double-headed (is that one male or female? It's male, isn't it?) composite cable from the video adapter to the VCR. The problem is, it doesn't show up. The sound plays (and records) fine, but the video neither shows up on the TV screen nor records onto the tape. What's the problem? Both adapters are Dynex, my computer's a Late 2006 iMac (I think), the cable is WireLogic, and both the VCR and TV are Sony. Please help, thanks.
So if you eliminate the double headed splitter and plug straight into the TV, does the video still not show up?
FYI, there have been reports in the past of trouble with the Dynex video adapter. You may need to purchase the Apple OEM one. The Dynex may lack having a ROM inside of it with a proper EDID in the ROM. This is crucial to the Mac. -
Trouble Using Apple's Video Adapter
I am having trouble getting my eMac to work with the Apple Mini-DVI to Video Adapter. There are no directions telling you how to use it or to even get it to work. I want to use it to import videos from my Sony Hi8 camcorder and was told by Apple's Live help that this is what I needed to import video and make DVDs. How do I get this adapter to work?
Welcome aboard.
I think the adapter you have is for video output, not input. To input video to the eMac you need a firewire connection. Sony cameras typically have a 4 wire connector which is smaller than the 6 wire plug on the mac, so you need a cable that has a 4 wire connector on one end and a 6 wire connector on the other. Cameras often (but not always) come with such a cable. You also need a digital camcorder- not just Hi8., although Sony does make cameras that will do both. If you camera does not have digital output, you need a convertor box. -
Hello,
I am having trouble with my MacBook Air 13 inch June 2012 MacBook Air5, 2 4GB RAM details below in Etresoft report. I recently upgraded to Yosemite and am having system trouble. My computer crashes and I have to force quit to restart. When using webmail there is a black screen for a split second between pages. This did not happen before. I am worried that it is not running properly and perhaps I need to revert to the previous operating system. I only have a MacBook Air and no need to share images between a tablet or phone so I did not need the new photo sharing software of Yosemite. I wonder if I don't have enough RAM to run it? I did not run time machine before I made the upgrade as I did not realise the significance of an upgrade as not very Mac literate. Any advice on whether my system is in danger... most appreciated! I am writing a book and making a back up but this machine is my lifeline and my work is conducted through it. It ran perfectly before... the Yosemite upgrade has perhaps highlighted some problems and it has unnerved me!
Thanks ever so much for your advice!
Lillibet
EtreCheck version: 2.2 (132)
Report generated 5/2/15, 9:53 PM
Download EtreCheck from http://etresoft.com/etrecheck
Click the [Click for support] links for help with non-Apple products.
Click the [Click for details] links for more information about that line.
Hardware Information: ℹ️
MacBook Air (13-inch, Mid 2012) (Technical Specifications)
MacBook Air - model: MacBookAir5,2
1 1.8 GHz Intel Core i5 CPU: 2-core
4 GB RAM Not upgradeable
BANK 0/DIMM0
2 GB DDR3 1600 MHz ok
BANK 1/DIMM0
2 GB DDR3 1600 MHz ok
Bluetooth: Good - Handoff/Airdrop2 supported
Wireless: en0: 802.11 a/b/g/n
Battery: Health = Normal - Cycle count = 694 - SN = D86218700K2DKRNAF
Video Information: ℹ️
Intel HD Graphics 4000
Color LCD 1440 x 900
System Software: ℹ️
OS X 10.10.3 (14D136) - Time since boot: 0:22:41
Disk Information: ℹ️
APPLE SSD SM256E disk0 : (251 GB)
EFI (disk0s1) <not mounted> : 210 MB
Recovery HD (disk0s3) <not mounted> [Recovery]: 650 MB
Macintosh HD (disk1) / : 249.77 GB (167.35 GB free)
Encrypted AES-XTS Unlocked
Core Storage: disk0s2 250.14 GB Online
USB Information: ℹ️
Apple, Inc. Keyboard Hub
Mitsumi Electric Apple Optical USB Mouse
Apple Inc. Apple Keyboard
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. BRCM20702 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Internal Memory Card Reader
Apple Inc. Apple Internal Keyboard / Trackpad
Thunderbolt Information: ℹ️
Apple Inc. thunderbolt_bus
Gatekeeper: ℹ️
Mac App Store and identified developers
Kernel Extensions: ℹ️
/Applications/WD +TURBO Installer.app
[not loaded] com.wdc.driver.1394HP (1.0.11 - SDK 10.4) [Click for support]
[not loaded] com.wdc.driver.1394_64HP (1.0.1 - SDK 10.6) [Click for support]
[not loaded] com.wdc.driver.USB-64HP (1.0.3) [Click for support]
[not loaded] com.wdc.driver.USBHP (1.0.14) [Click for support]
/System/Library/Extensions
[not loaded] com.wdc.driver.1394.64.10.9 (1.0.1 - SDK 10.9) [Click for support]
[loaded] com.wdc.driver.USB.64.10.9 (1.0.1 - SDK 10.9) [Click for support]
Problem System Launch Daemons: ℹ️
[failed] com.apple.mtrecorder.plist
Launch Agents: ℹ️
[running] com.mcafee.menulet.plist [Click for support]
[running] com.mcafee.reporter.plist [Click for support]
[loaded] com.oracle.java.Java-Updater.plist [Click for support]
Launch Daemons: ℹ️
[running] com.adobe.ARM.[...].plist [Click for support]
[loaded] com.adobe.fpsaud.plist [Click for support]
[failed] com.apple.spirecorder.plist
[running] com.mcafee.ssm.Eupdate.plist [Click for support]
[running] com.mcafee.ssm.ScanManager.plist [Click for support]
[running] com.mcafee.virusscan.fmpd.plist [Click for support]
[loaded] com.oracle.java.Helper-Tool.plist [Click for support]
User Launch Agents: ℹ️
[loaded] com.adobe.ARM.[...].plist [Click for support]
[loaded] com.google.keystone.agent.plist [Click for support]
User Login Items: ℹ️
iTunesHelper Application Hidden (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
Dropbox Application (/Applications/Dropbox.app)
AdobeResourceSynchronizer Application Hidden (/Applications/Adobe Reader.app/Contents/Support/AdobeResourceSynchronizer.app)
EvernoteHelper Application (/Applications/Evernote.app/Contents/Library/LoginItems/EvernoteHelper.app)
TouchP-150M Application (/Applications/Canon P-150M/TouchP-150M.app)
iPhoto Application (/Applications/iPhoto.app)
WDDriveUtilityHelper Application (/Applications/WD Drive Utilities.app/Contents/WDDriveUtilityHelper.app)
WDSecurityHelper Application (/Applications/WD Security.app/Contents/WDSecurityHelper.app)
Internet Plug-ins: ℹ️
FlashPlayer-10.6: Version: 17.0.0.169 - SDK 10.6 [Click for support]
QuickTime Plugin: Version: 7.7.3
AdobePDFViewerNPAPI: Version: 11.0.10 - SDK 10.6 [Click for support]
AdobePDFViewer: Version: 11.0.10 - SDK 10.6 [Click for support]
Flash Player: Version: 17.0.0.169 - SDK 10.6 [Click for support]
Default Browser: Version: 600 - SDK 10.10
JavaAppletPlugin: Version: Java 8 Update 45 Check version
3rd Party Preference Panes: ℹ️
Flash Player [Click for support]
FUSE for OS X (OSXFUSE) [Click for support]
Java [Click for support]
MacFUSE [Click for support]
NTFS-3G [Click for support]
Time Machine: ℹ️
Skip System Files: NO
Mobile backups: ON
Auto backup: YES
Volumes being backed up:
Macintosh HD: Disk size: 249.77 GB Disk used: 82.42 GB
Destinations:
My Passport Edge for Mac [Local]
Total size: 499.94 GB
Total number of backups: 27
Oldest backup: 2013-01-31 21:15:26 +0000
Last backup: 2015-05-02 11:33:09 +0000
Size of backup disk: Adequate
Backup size 499.94 GB > (Disk used 82.42 GB X 3)
Top Processes by CPU: ℹ️
6% WindowServer
3% fontd
2% VShieldScanManager
0% taskgated
0% notifyd
Top Processes by Memory: ℹ️
745 MB Google Chrome Helper(8)
439 MB kernel_task
246 MB VShieldScanner(3)
160 MB Google Chrome
127 MB Finder
Virtual Memory Information: ℹ️
130 MB Free RAM
3.87 GB Used RAM
0 B Swap Used
Diagnostics Information: ℹ️
May 2, 2015, 09:30:08 PM Self test - passed
May 2, 2015, 08:52:59 PM /Users/[redacted]/Library/Logs/DiagnosticReports/soffice_2015-05-02-205259_[red acted].crash
May 2, 2015, 09:28:53 AM /Library/Logs/DiagnosticReports/backupd_2015-05-02-092853_[redacted].cpu_resour ce.diag [Click for details]
May 1, 2015, 05:45:24 PM /Users/[redacted]/Library/Logs/DiagnosticReports/EvernoteHelper_2015-05-01-1745 24_[redacted].crash
May 1, 2015, 05:38:54 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173854_[redacted].crash
May 1, 2015, 05:38:43 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173843_[redacted].crash
May 1, 2015, 05:38:32 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173832_[redacted].crash
May 1, 2015, 05:38:27 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173827_[redacted].crash
May 1, 2015, 05:38:10 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173810_[redacted].crash
May 1, 2015, 05:38:00 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173800_[redacted].crash
May 1, 2015, 05:37:49 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173749_[redacted].crash
May 1, 2015, 05:37:38 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173738_[redacted].crash
May 1, 2015, 05:37:27 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173727_[redacted].crash
May 1, 2015, 05:37:22 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173722_[redacted].crash
May 1, 2015, 05:37:06 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173706_[redacted].crash
May 1, 2015, 05:36:55 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173655_[redacted].crash
May 1, 2015, 05:36:44 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173644_[redacted].crash
May 1, 2015, 05:36:33 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173633_[redacted].crash
May 1, 2015, 05:36:22 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173622_[redacted].crash
May 1, 2015, 05:36:17 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173617_[redacted].crash
May 1, 2015, 05:36:01 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173601_[redacted].crash
May 1, 2015, 05:35:50 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173550_[redacted].crash
May 1, 2015, 05:35:39 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173539_[redacted].crash
May 1, 2015, 05:35:28 PM /Library/Logs/DiagnosticReports/mds_2015-05-01-173528_[redacted].crash
May 1, 2015, 05:20:29 PM /Users/[redacted]/Library/Logs/DiagnosticReports/soffice_2015-05-01-172029_[red acted].crash
May 1, 2015, 04:55:05 PM /Users/[redacted]/Library/Logs/DiagnosticReports/soffice_2015-05-01-165505_[red acted].crash
May 1, 2015, 02:53:58 PM /Library/Logs/DiagnosticReports/sharingd_2015-05-01-145358_[redacted].crash
Apr 20, 2015, 09:31:20 PM /Library/Logs/DiagnosticReports/Kernel_2015-04-20-213120_[redacted].panic [Click for details]When you have kernel panics, the pertinent information is in the panic report.
These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad and start typing the name.
In the Console window, select
DIAGNOSTIC AND USAGE INFORMATION ▹ System Diagnostic Reports
(not Diagnostic and Usage Messages) from the log list on the left. If you don't see that list, select
View ▹ Show Log List
from the menu bar.
There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of reports. A panic report has a name that begins with "Kernel" and ends in ".panic". Select the most recent one. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
If you don't see any reports listed, but you know there was a panic, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
Please don’t post other kinds of diagnostic report.
I know the report is long, maybe several hundred lines. Please post all of it anyway. -
how do I trouble shoot this?
emanwine wrote:
Got it to connect and it is my back up. ...
Good News.
If this is your only Backup would suggest getting a New EHD and creating another one... Preferably a Clone if you don't already have one.
http://www.bombich.com/
Can never have too many Backups... -
I am having trouble printing to an Epson XP600. We have replaced the printer and we are still having the same problem. When I try to print from Excel, only the color prints. Any suggestions?
Has anyone else had issues not being able to print black (such as a document)? My photos print great, but when I try to print a simple black-ink document, it won't work. Any suggestions?
Maybe you are looking for
-
Problem in using the f:attribute tag in JSF
when I am trying to loop the JSF using the JSTL tag <c:foreach> I am getting the value as "Error:form_id0" .cold any one help me please
-
How can I improve my phone signal most of the time I have no service
How can I improve my signal - my old android phone had a brilliant signal however more often than not I have no signal on the iphone
-
Error exists when Admin2 loads same file in BW but loads ok for Admin1. Why
Hi, Why does this error exists when Admin2 loads same file but loads ok for Admin1? A u201CCalendaru201D column in a flat file has value 200810 i.e. October of 2008. BW Admin 1: When Admin1 loads this file, it comes out ok as Calendar Year/Month as
-
Why do I get this strange message from Adobe on my MacBook Pro?
Why do I keep getting a message that says something like "we want to share the space in your computer"? Since the message said it was from Adobe, I removed an Adobe file. Now the message is gone, but I cannot open various programs that tell me I nee
-
QTL: Behaviour on Windows
I have used QTL files to link to QT movies on my site. The 'movies' are audio only (no images). Clicking on them on a Mac does the expected thing - the QT player launches and the mov file streams according to the settings in the QTL text. On Windows