Aggreate functions(cube,rollup)
Hi,
Is it possible to use aggrgate funtions (cube, rollup) with Oracle Express ?
Thanks
Marco
I don't find any documentation about aggregate functions like cube, rollup, grouping set in XE librairy. But it works !
select MANAGER_ID, DEPARTMENT_ID, count(EMPLOYEE_ID)
from HR.EMPLOYEES
group by rollup MANAGER_ID, DEPARTMENT_ID);
select MANAGER_ID, DEPARTMENT_ID, count(EMPLOYEE_ID)
from HR.EMPLOYEES
group by cube (MANAGER_ID, DEPARTMENT_ID);
select MANAGER_ID, DEPARTMENT_ID, count(EMPLOYEE_ID)
from HR.EMPLOYEES
group by
grouping sets (MANAGER_ID, DEPARTMENT_ID);
It's great !
Similar Messages
-
Hi
what is the difference between Cube and Rollup
and what's the difference if I say for example :
Group by ( job_id, Division_id) or I say : Group by (Division_id, Job_id) ;
ML.Hi,
Mr.lonely wrote:
hi,
I could do that my self ...Great! Then you don't have to go throught the trouble of posting a message on this forum. The documentation is more reliable, and more comprehensive, than the answers you get here. The manual can be faster, and it's never sarcastic.
This forum is a great place for posting questions when the documentation isn't clear, or seems to be contradictory. For example: "The SQL language 11.2 manual gives this example: ... When I tried ths ... I expected the output to be ... but instead I got ... Why? The manual even says ...".
This forum is also a good place to ask questions about how to use features. For example: "This query with GROUP BY ROLLUP ... seems to do the same thing as this one using GROUPING SETS .... Are there any situations in which these 2 queries would not produce the same results? Is one of them better that the other in this case? I tried to to the same thing using CUBE, like this ... but I ggot this error: .... Are there any guidlines for when ROLLUP is better than GROUPING SETS, and when GROUPING SETS is better than ROLLUP? -
XPath expressions in aggreation functions behave different than I expect
Hi,
I'm having the following very simple schema:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a" type="AType" />
<xs:complexType name="AType">
<xs:sequence>
<xs:element name="b" type="BType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="BType">
<xs:sequence>
<xs:element name="c" type="CType" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CType">
<xs:all minOccurs="0">
<xs:element name="d1" type="xs:double" />
<xs:element name="d2" type="xs:double" />
<xs:element name="d3" type="xs:double" />
<xs:element name="d4" type="xs:double" />
<xs:element name="d5" type="xs:double" />
<xs:element name="d6" type="xs:double" />
</xs:all>
</xs:complexType>
</xs:schema>
Which I loaded using the following code:
declare
l_bfile bfile;
begin
l_bfile := bfilename('DIR_TEMP', 'simple.xsd');
dbms_lob.open(l_bfile);
dbms_xmlschema.registerschema('http://localhost/simple.xsd',l_bfile);
dbms_lob.close(l_bfile);
end;
Then I created the table "simple" as follows:
CREATE TABLE simple OF XMLTYPE XMLSchema "http://localhost/simple.xsd" ELEMENT "a";
And I loaded the following XML document:
<?xml version="1.0"?><a>< b>
<c><d1>0</d1></c>
<c><d1>1</d1></c>
<c><d1>2</d1></c>
<c><d1>3</d1></c>
<c><d1>4</d1></c>
<c><d1>5</d1></c>
<c><d1>6</d1></c>
<c><d1>7</d1></c>
<c><d1>8</d1></c>
<c><d1>9</d1></c>
</b></a>
Which was loaded by the following code:
DECLARE
file bfile;
charContent clob := ' ';
targetFile bfile;
charset_id number := 0;
src_offset number := 1;
dst_offset number := 1;
lang_ctx number := DBMS_LOB.default_lang_ctx;
warning number;
BEGIN
DBMS_OUTPUT.enable(10000);
file := bfilename('DIR_TEMP','simple.xml');
targetFile := file;
DBMS_LOB.fileopen(targetFile,DBMS_LOB.file_readonly);
DBMS_LOB.loadclobfromfile(charContent,targetFile,DBMS_LOB.getLength(targetFile),src_offset, dst_offset, charset_id, lang_ctx, warning);
DBMS_LOB.fileclose(targetfile);
INSERT INTO simple VALUES (xmltype(charContent));
END;
The function to be executed is the avg of d1. The solution if of course 4.5.
The following queries give the correct answer:
SELECT XMLQuery('for $i in /a return avg($i//d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg(//d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a let $t := //d1 return avg($t)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
However, when I execute any of the following expressions, they return nothing (or to be exact: an empty row):
SELECT XMLQuery('for $i in /a return avg($i/b/c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg($i//c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg(//c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a let $t := //c/d1 return avg($t)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
I'm expecting that avg($i//c/d1) selects all d1 elements contained in a c element within the context of $i and return the average of those d1s. However, it doesn't seem to do so.
When I remove the "avg" in the last query:
SELECT XMLQuery('for $i in /a let $t := //c/d1 return $t' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
it does return a list of all d1 elements, as I expect. However the aggragation function doesn't return the value as expected. I've tested with more aggregation functions (eg. min, max) and all are having the same effects.
Can anyone explain me what I'm missing here, or point me to some documentation which explains it?
I'm running:
SQL*Plus: Release 10.2.0.3.0 - Production
on
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
null
Message was edited by:
TijinkDid you also try to create the XMLSchema and the table and run the queries against that?Still, no difference for me:
michaels> declare
l_clob clob
:= '<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a" type="AType" />
<xs:complexType name="AType">
<xs:sequence>
<xs:element name="b" type="BType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="BType">
<xs:sequence>
<xs:element name="c" type="CType" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CType">
<xs:all minOccurs="0">
<xs:element name="d1" type="xs:double" />
<xs:element name="d2" type="xs:double" />
<xs:element name="d3" type="xs:double" />
<xs:element name="d4" type="xs:double" />
<xs:element name="d5" type="xs:double" />
<xs:element name="d6" type="xs:double" />
</xs:all>
</xs:complexType>
</xs:schema>';
begin
dbms_xmlschema.registerschema (schemaurl => 'http://localhost/simple.xsd',
schemadoc => l_clob,
gentypes => false
end;
PL/SQL procedure successfully completed.
michaels> create table simple of xmltype xmlschema "http://localhost/simple.xsd" element "a"
Table created.
michaels> insert into simple
values (xmltype
('<?xml version="1.0"?><a><b>
<c><d1>0</d1></c>
<c><d1>1</d1></c>
<c><d1>2</d1></c>
<c><d1>3</d1></c>
<c><d1>4</d1></c>
<c><d1>5</d1></c>
<c><d1>6</d1></c>
<c><d1>7</d1></c>
<c><d1>8</d1></c>
<c><d1>9</d1></c></b></a>'
1 row created.
michaels> select xmlquery('for $i in /a return avg($i//d1)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg(//d1)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a let $t := //d1 return avg($t)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg($i/b/c/d1)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg($i//c/d1)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg(//c/d1)' passing object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a let $t := //c/d1 return avg($t)' passing object_value returning content).getnumberval() res from simple
RES
4,5
4,5
4,5
4,5
4,5
4,5
4,5
7 rows selected. -
Crosstab report with XML Publisher without aggreate function
Hi Gurus,
I have query that returning the task schedule of the man power as below
Source Date Week Day Customer Activity Service
Pat
16-Oct-14
42
T
C1
A1
S1
Pat
17-Oct-14
42
F
C1
A1
S1
Pat
18-Oct-14
42
S
Pat
19-Oct-14
42
S
Pat
20-Oct-14
43
M
Pat
21-Oct-14
43
T
Pat
22-Oct-14
43
W
Pat
23-Oct-14
43
T
C2
S2
Pat
24-Oct-14
43
F
Riley
16-Oct-14
42
T
C3
A1
S3
Riley
17-Oct-14
42
F
Riley
18-Oct-14
42
S
Riley
19-Oct-14
42
S
C4
A1
S4
Riley
20-Oct-14
43
M
Riley
21-Oct-14
43
T
Riley
22-Oct-14
43
W
Riley
23-Oct-14
43
T
Riley
24-Oct-14
43
F
and want to format the output as weekly calendar as below (the week must be dynamic depends on number of dates return) using XML Publisher 10.1.3.3.3
Week-42 Week-43
Source Date Day Customers Activity Service Code Date Day Customers Activity Service Code
Pat 16-Oct-14 T C1 A1 S1 20-Oct-14 M
17-Oct-14 F C1 A1 S1 21-Oct-14 T
18-Oct-14 S 22-Oct-14 W
19-Oct-14 S 23-Oct-14 T C2 S2
24-Oct-14 F
Riley 16-Oct-14 T C3 A1 S3 20-Oct-14 M
17-Oct-14 F 21-Oct-14 T
18-Oct-14 S 22-Oct-14 W
19-Oct-14 S C4 A1 S4 23-Oct-14 T
24-Oct-14 F
Is it possible to do that?
Regards,
FendyYes, I got it working.
Follow the instructions as mentioned in the User Guide, it will workout well.
1. Create a concurrent program with "XDODTEXE" as the Executable.
2. Create the data definition and associate a data template (this is with your sql) to it and and link the above concurrent program with this data definition.
Let me know if you need more details. Good thing about this is that you do not have to move any files on to your unix server (like in the case of oracle reports). -
Advance aggreate function: help required
Hi All, Pls help me in solving the below requirement
Sample Data:
F1 F2 F3
[email protected] A 1
[email protected] B 1
[email protected] A 2
[email protected] A 1
Unique combination of F2 & F3 to be treated as a account.
Need to find the total accounts related to the domain along
with Unique emailID's and the accounts related to each email.
Required Output:
o1 o2 o3 o4
d1.com [email protected] 3 2
d1.com [email protected] 3 1
d1.com [email protected] 3 1
o1: Domain
o2: Unique email ID's in the Domain
o3: Unique accounts accessible by Domain
o4: Unique accounts accessible by Email
I'm able to get o1, o2 & o4 with the following sql
SELECT a.domain, a.F1, COUNT (a.rnum)
FROM (SELECT UNIQUE ROWNUM rnum,
SUBSTR (TRIM (F1),
INSTR (TRIM (F1), '@') + 1
) AS domain,
F1, F2, F3
FROM tab1
WHERE F1 LIKE '%d1.com%') a
GROUP BY a.domain, a.F1
Pls help me in completing this sql for the required output.
Thanks :-)What version/edition of Oracle are you using? Can you use analytics?
SELECT a.domain, a.F1, COUNT (a.rnum),
count(a.domain) over (partition by a.domain) domain_count
FROM (SELECT UNIQUE ROWNUM rnum,
SUBSTR (TRIM (F1),
INSTR (TRIM (F1), '@') + 1
) AS domain,
F1, F2, F3
FROM tab1
WHERE F1 LIKE '%d1.com%') a
GROUP BY a.domain, a.F1;
DOMAIN F1 COUNT(A.RNUM) DOMAIN_COUNT
d1.com [email protected] 2 3
d1.com [email protected] 1 3
d1.com [email protected] 1 3 -
Case not working with aggreate function
i a writing the these SQL lines which is basically alternative approach of pivot keyword using in SQL Server
2005
but here i am using CASE statement if DateNumber exists then give count of ParticulersCount otherwise null
select Particulers
,sum(case when DateNumber=1
then ParticulersCount else NULL end )1
,sum(case when DateNumber=2
then ParticulersCount else NULL end)2
,sum(ParticulersCount) Total
from GTT_OUTPAT
group by Particulers;
Error
SQL Error: ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:Hi,
If you want identifiers to be named 1 and 2, you need to enclose them in double quotes:
select Particulers
,sum(case when DateNumber=1
then ParticulersCount
else NULL end) "1"
,sum(case when DateNumber=2
then ParticulersCount
else NULL end) "2"
,sum(ParticulersCount) Total
from GTT_OUTPAT
group by Particulers;Regards
Peter -
can anybody explain the functionality of ROLLUP and CUBE functions in oracle9i
Lets do us all a favor and use current docs (that is < 11g which is still too new for most)
http://www.oracle.com/pls/db102/homepage -
ROLLUP AND CUBE OPERATORS IN ORACLE 8I
제품 : PL/SQL
작성날짜 : 2000-06-29
========================================
ROLLUP AND CUBE OPERATORS IN ORACLE 8I
========================================
PURPOSE
ROLLUP 과 CUBE Operator에 대해 설명하고자 한다.
Explanation
ROLLUP operator는 SELECT문의 GROUP BY절에 사용된다.
SELECT절에 ROLLUP 을 사용함으로써 'regular rows'(보통의 select된 data)와
'super-aggregate rows'(총계)을 구할 수 있다. 기존에는 select ... union select
를 이용해 구사해야 했었던 것이다. 'super-aggregate rows'는 'sub-total'
(중간 Total, 즉 소계)을 포함한다.
CUBE operator는 Cross-tab에 대한 Summary를 추출하는데 사용된다. 모든 가능한
dimension에 대한 total을 나타낸다. 즉 ROLLUP에 의해 나타내어지는 item total값과
column total값을 나타낸다.
NULL값은 모든 값에 대한 super-aggregate 을 나타낸다. GROUPING() function은
모든 값에 대한 set을 나타내는 null값과 column의 null값과 구별하는데 쓰여진다.
GROUPING() function은 GROUP BY절에서 반드시 표현되어야 한다. GROUPING()은 모든
값의 set을 표현합에 있어서 null이면 1을 아니면 0을 return한다.
ROLLUP과 CUBE는 CREATE MATERIALIZED VIEW에서 사용되어 질수 있다.
Example
아래와 같이 테스트에 쓰여질 table과 data을 만든다.
create table test_roll
(YEAR NUMBER(4),
REGION CHAR(7),
DEPT CHAR(2),
PROFIT NUMBER );
insert into test_roll values (1995 ,'West' , 'A1' , 100);
insert into test_roll values (1995 ,'West' , 'A2' , 100);
insert into test_roll values (1996 ,'West' , 'A1' , 100);
insert into test_roll values (1996 ,'West' , 'A2' , 100);
insert into test_roll values (1995 ,'Central' ,'A1' , 100);
insert into test_roll values (1995 ,'East' , 'A1' , 100);
insert into test_roll values (1995 ,'East' , 'A2' , 100);
SQL> select * from test_roll;
YEAR REGION DE PROFIT
1995 West A1 100
1995 West A2 100
1996 West A1 100
1996 West A2 100
1995 Central A1 100
1995 East A1 100
1995 East A2 100
7 rows selected.
예제 1: ROLLUP
SQL> select year, region, sum(profit), count(*)
from test_roll
group by rollup(year, region);
YEAR REGION SUM(PROFIT) COUNT(*)
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
700 7
7 rows selected.
위의 내용을 tabular로 나타내어 보면 쉽게 알 수 있다.
Year Central(A1+A2) East(A1+A2) West(A1+A2)
1995 (100+NULL) (100+100) (100+100) 500
1996 (NULL+NULL) (NULL+NULL) (100+100) 200
700
예제 2: ROLLUP and GROUPING()
SQL> select year, region, sum(profit),
grouping(year) "Y", grouping(region) "R"
from test_roll
group by rollup (year, region);
YEAR REGION SUM(PROFIT) Y R
1995 Central 100 0 0
1995 East 200 0 0
1995 West 200 0 0
1995 500 0 1
1996 West 200 0 0
1996 200 0 1
700 1 1
7 rows selected.
참고) null값이 모든 값의 set에 대한 표현으로 나타내어지면 GROUPING function은
super-aggregate row에 대해 1을 return한다.
예제 3: CUBE
SQL> select year, region, sum(profit), count(*)
from test_roll
group by cube(year, region);
YEAR REGION SUM(PROFIT) COUNT(*)
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
Central 100 1
East 200 2
West 400 4
700 7
위의 내용을 tabular로 나타내어 보면 쉽게 알 수 있다.
Year Central(A1+A2) East(A1+A2) West(A1+A2)
1995 (100+NULL) (100+100) (100+100) 500
1996 (NULL+NULL) (NULL+NULL) (100+100) 200
100 200 400 700
예제 4: CUBE and GROUPING()
SQL> select year, region, sum(profit),
grouping(year) "Y", grouping(region) "R"
from test_roll
group by cube (year, region);
YEAR REGION SUM(PROFIT) Y R
1995 Central 100 0 0
1995 East 200 0 0
1995 West 200 0 0
1995 500 0 1
1996 West 200 0 0
1996 200 0 1
Central 100 1 0
East 200 1 0
West 400 1 0
700 1 1
10 rows selected.
===============================================
HOW TO USE ROLLUP AND CUBE OPERATORS IN PL/SQL
===============================================
Release 8.1.5 PL/SQL에서는 CUBE, ROLLUP 이 지원되지 않는다. 8i에서는 DBMS_SQL
package을 이용하여 dynamic SQL로 구현하는 방법이 workaround로 제시된다.
Ordacle8i에서는 PL/SQL block에 SQL절을 직접적으로 위치시키는 Native Dynamic SQL
(참고 bul#11721)을 지원한다.
Native Dynamic SQL을 사용하기 위해서는 COMPATIBLE 이 8.1.0 또는 그 보다 높아야
한다.
SVRMGR> show parameter compatible
NAME TYPE VALUE
compatible string 8.1.0
예제 1-1: ROLLUP -> 위의 예제 1과 비교한다.
SQL> create or replace procedure test_rollup as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
select year, region, sum(profit), count(*)
into my_year, my_region, my_sum, my_count
from test_roll
group by rollup(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TEST_ROLLUP:
LINE/COL ERROR
10/8 PL/SQL: SQL Statement ignored
13/18 PLS-00201: identifier 'ROLLUP' must be declared
SQL> create or replace procedure test_rollup as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
sql_stmt := 'select year, region, sum(profit), count(*) ' ||
'from test_roll ' ||
'group by rollup(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||
nvl(my_region,' ') ||
' ' || my_sum || ' ' || my_count);
end loop;
close tab_cv;
end;
SQL> set serveroutput on
SQL> exec test_rollup
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
700 7
PL/SQL procedure successfully completed.
예제 2-1: ROLLUP and GROUPING() -> 위의 예제 2와 비교한다.
SQL> create or replace procedure test_rollupg as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
select year, region, sum(profit),
grouping(year), grouping(region)
into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region
from test_roll
group by rollup(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_ROLLUPG:
LINE/COL ERROR
12/4 PL/SQL: SQL Statement ignored
17/13 PLS-00201: identifier 'ROLLUP' must be declared
SQL> create or replace procedure test_rollupg as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
sql_stmt := 'select year, region, sum(profit), count(*), ' ||
'grouping(year), grouping(region) ' ||
'from test_roll ' ||
'group by rollup(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||my_region ||
' ' || my_sum || ' ' || my_count ||
' ' || my_g_year || ' ' || my_g_region);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_rollupg
1995 Central 100 1 0 0
1995 East 200 2 0 0
1995 West 200 2 0 0
1995 500 5 0 1
1996 West 200 2 0 0
1996 200 2 0 1
700 7 1 1
PL/SQL procedure successfully completed.
예제 3-1: CUBE -> 위의 예제 3과 비교한다.
SQL> create or replace procedure test_cube as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
select year, region, sum(profit), count(*)
into my_year, my_region, my_sum, my_count
from test_roll
group by cube(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_CUBE:
LINE/COL ERROR
10/4 PL/SQL: SQL Statement ignored
13/13 PLS-00201: identifier 'CUBE' must be declared
SQL> create or replace procedure test_cube as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
begin
sql_stmt := 'select year, region, sum(profit), count(*) ' ||
'from test_roll ' ||
'group by cube(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||
nvl(my_region,' ') ||
' ' || my_sum || ' ' || my_count);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_cube
1995 Central 100 1
1995 East 200 2
1995 West 200 2
1995 500 5
1996 West 200 2
1996 200 2
Central 100 1
East 200 2
West 400 4
700 7
PL/SQL procedure successfully completed.
예제 4-1: CUBE and GROUPING() -> 위의 예제 4와 비교한다.
SQL> create or replace procedure test_cubeg as
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
select year, region, sum(profit),
grouping(year), grouping(region)
into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region
from test_roll
group by cube(year, region);
end;
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TEST_CUBEG:
LINE/COL ERROR
12/4 PL/SQL: SQL Statement ignored
17/13 PLS-00201: identifier 'CUBE' must be declared
SQL> create or replace procedure test_cubeg as
type curTyp is ref cursor;
sql_stmt varchar2(200);
tab_cv curTyp;
my_year test_roll.year%type;
my_region test_roll.region%type;
my_sum int;
my_count int;
my_g_region int;
my_g_year int;
begin
sql_stmt := 'select year, region, sum(profit), count(*), ' ||
'grouping(year), grouping(region) ' ||
'from test_roll ' ||
'group by cube(year, region)';
open tab_cv for sql_stmt;
loop
fetch tab_cv into my_year, my_region, my_sum, my_count,
my_g_year, my_g_region;
exit when tab_cv%NOTFOUND;
dbms_output.put_line (my_year || ' '||my_region ||
' ' || my_sum || ' ' || my_count ||
' ' || my_g_year || ' ' || my_g_region);
end loop;
close tab_cv;
end;
Procedure created.
SQL> set serveroutput on
SQL> exec test_cubeg
1995 Central 100 1 0 0
1995 East 200 2 0 0
1995 West 200 2 0 0
1995 500 5 0 1
1996 West 200 2 0 0
1996 200 2 0 1
Central 100 1 1 0
East 200 2 1 0
West 400 4 1 0
700 7 1 1
PL/SQL procedure successfully completed.
Reference Ducumment
Note:67988.1Hello,
As previously posted you should use export and import utilities.
To execute exp or imp statements you have just to open a command line interface, for instance,
a DOS box on Windows.
So you don't have to use SQL*Plus or TOAD.
About export/import you may care on the mode, to export a single or a list of Tables the Table mode
is enough.
Please, find here an example to begin:
http://wiki.oracle.com/page/Oracle+export+and+import+
Hope this help.
Best regards,
Jean-Valentin -
Running Total (or) Moving Sum (or) Rollup using Date functions
I have to pass the Begin date and End date using prompt in my application (for daily basis for one month, monthly and yearly).
How can i use the date function for Rollup the days values(running total) for the below mentioned SQL
Table.Date field (@Prompt('Begin_Date','D',,mono,free) and @Prompt('End_Date','D',,mono,free)
@prompt automatically takes the begin date and end date.
I need the sql for rollup(running total) on daily basis for one month say jan 1 to jan 31.
Any idea?Check the Oracle on-line documentation on the ROLLUP option of the GROUP BY clause. It should be able to give you running totals.
-
Creating Weighted Average Sub-Totals in Standard Apex Report
Based upon the below query, I am trying to have a Standard SQL report produce Weighted Average sub totals for 4 columns
SELECT Pool
, order_by
, Pool_order
, Perf_Non_Perf
, CurrBal
, LowVal
, HighVal
, LossHigh
, LossLow
, CalcCurrBal
, DECODE(CurrBal,0,0,(LowVal/CurrBal * 100 )) AS LowPercent
, DECODE(CurrBal,0,0,(HighVal/CurrBal * 100 )) AS HighPercent
, DECODE(CalcCurrBal,0,0,(LossHigh/CalcCurrBal * 100)) AS LossHighPercent
, DECODE(CalcCurrBal,0,0,(LossLow/CalcCurrBal * 100)) AS LossLowPercent
From (
SELECT Pool
, 1 as order_by
, Pool Pool_order
, Perf_Non_Perf
, Sum(Current_Balance) AS CurrBal
, Sum(Low_Value) AS LowVal
, Sum(High_Value) AS HighVal
, Sum(Calculated_Cumm_Loss_High) AS LossHigh
, Sum(Calculated_Cumm_Loss_Low) AS LossLow
, Sum(Current_Balance_to_Calc_Cumm_L) AS CalcCurrBal
FROM Current_Data
GROUP BY Pool, Perf_Non_Perf
ORDER BY Pool, Perf_Non_Perf DESCThe columns in question are:
LowPercent
HighPercent
LossHighPercent
LossLowPercent
Any ideas other than using a union to add the sub-totals in as a separate query (trying to keep this confined to one query if possible)..
Thank you,
Tony Miller
Dallas, TXTony,
The PL/SQL forum may answer this better but had you considered the ROLLUP or CUBE GROUP BY functions? ROLLUP would look like this in your query:
SELECT pool,
order_by,
pool_order,
perf_non_perf,
currbal,
lowval,
highval,
losshigh,
losslow,
calccurrbal,
SUM (DECODE (currbal, 0, 0, (lowval / currbal * 100))) AS lowpercent,
SUM (DECODE (currbal, 0, 0, (highval / currbal * 100))) AS highpercent,
SUM (DECODE (calccurrbal, 0, 0, (losshigh / calccurrbal * 100)))
AS losshighpercent,
SUM (DECODE (calccurrbal, 0, 0, (losslow / calccurrbal * 100)))
AS losslowpercent
FROM ( SELECT pool,
1 AS order_by,
pool pool_order,
perf_non_perf,
SUM (current_balance) AS currbal,
SUM (low_value) AS lowval,
SUM (high_value) AS highval,
SUM (calculated_cumm_loss_high) AS losshigh,
SUM (calculated_cumm_loss_low) AS losslow,
SUM (current_balance_to_calc_cumm_l) AS calccurrbal
FROM current_data
GROUP BY pool, perf_non_perf)
GROUP BY rollup (pool,
order_by,
pool_order,
perf_non_perf,
currbal,
lowval,
highval,
losshigh,
losslow,
calccurrbal)
ORDER BY pool, perf_non_perf DESCJeff -
BUSINESS INTELLIGENCE ENHANCEMENTS
제품 : SQL*PLUS
작성날짜 : 2004-05-17
==================================
BUSINESS INTELLIGENCE ENHANCEMENTS
==================================
PURPOSE
Oracle 9i에서 강화된 BUSINESS INTELLIGENCE 관련 내용을 요약해 본다.
Explanation
아래의 내용에 대해 설명될 것이다.
- enhanced된 Oracle9i analytical functions
- Use grouping sets
- Create SQL statements with the new WITH clause
Example
1. enhanced된 Oracle9i analytical functions
1) Inverse percentile functions (역백분위수 함수)
: 특정 percent에 해당하는 값을 찾는데 사용된다.
percentile_disc : 특정 백분위수에 가까운 값을 return하는 함수.
percentile_cont : linear interpolation을 사용하여 연속적인
백분위수를 계산하는 함수
ex) 1999년 11월달의 distribution channel당 판매량의 50%에 가까운
discrete value을 찾아라.
select c.channel_desc, avg(s.quantity_sold), percentile_disc(0.5)
within group
(order by s.quantity_sold desc) percentile_50
from sales s, channels c
where c.channel_id = s.channel_id
and time_id between '01-NOV-1999' and '30-NOV-1999'
group by c.channel_desc;
2) What-if rank and distribution functions
: 만약 어떤 data가 add된다면 이 data가 어느정도의 rank나 percenage에
속하는지를 찾는데 사용한다. what if analysis에 해당한다.
RANK : 그룹에서의 순위
DENSE_RANK : 중복값을 배제한 순위
PERCENT_RANK
CUME_DIST
ex) 새로운 사람이 고용되어 $10000 을 받는다면 부서당 salary을 비교할때
어느 정도 rank인가?
select department_id, round(avg(salary)) avg_salary,
rank(10000) within group (order by salary desc) rank,
dense_rank(10000) within group (order by salary desc) dense
from employees
group by department_id ;
3) FIRST/LAST aggregate functions
: 각 그룹의 첫번째나 마지막 값을 나타낼때 사용한다.
ex) manager당 commission을 가장 많이 받는 사람과 적게 받는 사람을 구하라.
select manager_id,
min(salary) keep (dense_rank first order by commission_pct)
as low_comm,
max(salary) keep (dense_rank last order by commission_pct)
as high_comm
from employees
where commission_pct is not null
group by manager_id;
4) WIDTH_BUCKET function
: with_bucket은 oracle 8i의 ntile과 비슷하다. 차이점은 ntile은 있는 모든
값을 그냥 정해진 bucket의 수로 나누는 것이고. with_bucket은 최소,최상
값을 정할 수 있다는 점이 다르다.
만약의 시험성적을 저장하고 있는 테이블이 있으면 각 점수별 분포를 확인
할때 사용할 수 있다.
With_bucket(expression, 0, 100,10)
그러면 10점 단위로 bucket이 생성되고 각 점수별 해당 bucket이 return된다.
ex) Low boundary value = 3000
High boundary value = 13000
Number of buckets = 5
select last_name, salary ,
width_bucket(salary,3000,13000,5) as sal_hist
from employees ;
5) Grouping sets
: group by절에 사용되며 소계나 특정 level의 소계등을 구할때 쓰인다.
2. Use grouping sets
1) 아래의 세개의 그룹에 대한, product가 10,20,45이고 1999년 11월의 1,2일에
해당하는 값을 구하라.
Time, Channel, Product
Time, Channel
Channel, Product
select time_id, channel_id, prod_id, round(sum(quantity_sold)) as cost
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,30)
group by grouping sets
((time_id,channel_id,prod_id),(time_id,channel_id),(channel_id,prod_id)) ;
2) GROUPING SETS vs. CUBE and ROLLUP (참고 bul#11914)
CUBE나 ROLLUP은 필요한 group만 볼수 없지만 9i에서는 1)와 같이 원하는
group만을 볼수 있다.
select time_id, channel_id, prod_id,
round(sum(quantity_sold)) as quantity_sum
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,45)
group by cube(time_id, channel_id, prod_id);
3) GROUPING SETS vs UNION ALL
Grouping sets절 대신에 union all을 사용하는 것은 table을 더 많이
scan하게 되고 문장을 구사하기가 비효율적이다.
아래의 두 문장은 같은 결과를 return한다.
select time_id, channel_id, prod_id,
round(sum(quantity_sold)) as quantity_sum
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,45)
group by grouping sets (time_id, channel_id, prod_id);
select to_char(time_id,'DD-MON-YY'),
round(sum(quantity_sold)) as quantity_sum
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,45)
group by time_id
union all
select channel_id ,
round(sum(quantity_sold)) as quantity_sum
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,45)
group by channel_id
union all
select to_char(prod_id) ,
round(sum(quantity_sold)) as quantity_sum
from sales
where (time_id = '01-DEC-1999' or time_id = '02-DEC-1999')
and prod_id in (10,20,45)
group by prod_id;
4) Composite Columns
아래의 세개의 그룹에 대한 product가 10,20,45이고 1999년 11월의 1,2일에
해당하는 값을 구하라.
Product
Product, Channel,Time
Grand Total
select prod_id, channel_id, time_id
, round(sum(quantity_sold)) as sales
from sales
where (time_id='01-DEC-1999' or time_id='02-DEC-1999')
and prod_id in (10,20,45)
group by rollup(prod_id,(channel_id, time_id))
3. Create SQL statements with the new WITH clause
복잡한 query의 Select절에서 같은 block을 한번 이상 query를 할때 쓰인다.
Query block의 값은 user의 temporary tablespace에 저장한다.
Perfoemance의 향상을 기대할 수 있다.
1) 전체 회사의 총 salary의 1/8보다 많은 부서를 구하라.
with
summary as (
select department_name, sum(salary) as dept_total
from employees, departments
where employees.department_id = departments.department_id
group by department_name)
select department_name, dept_total
from summary
where dept_total > (select sum(dept_total) * 1/8 from summary)
order by dept_total desc ;
2) 1)을 예전 version에서는 아래와 같이 구현하였다.
select department_name, sum(salary) as dept_total
from employees,departments
where employees.department_id=departments.department_id
group by department_name
having sum(salary) > ( select sum(salary) * 1/8
from employees, departments
where
employees.department_id=departments.department_id)
order by sum(salary) desc;
4. Benefits
Improved query speed
Enhanced developer productivity
Minimized learning effort
Standardized syntax
Reference Ducumment
Oracle 9i New features for DeveloperHi Rajasheker,
Without knowing the exact scenario it is hard to give you an answer but I hope the following broad guidelines might help you.
1) There must be some thing in common or it may be a case of wrong architecture/missing buseness requirements. Identify the relationship between these two.
2) Or, do they have a 100% parallel relationship by design? In this casse you need to create a high level common object (dummy) to facilitate the consolidatation process (for example company code or worst scheario sys-id) and enhance both cube as well as ODS.
3) Or, if it is a complex situation: Introduce a new object which can build a bridge between these two. Ask the business about the rules.
If it doesn't help, pl give more details.
Bala -
Having Percentage on the Totals line instead of SUM
Hi,
I have a report with several number columns and several percentage columns. I need to show a totals line with grand totals for the number columns, and overall percentage for the percentage columns - how can I achieve this? I guess there is a more general question about showing any non-SUM summary function on the totals line, such as AVG, COUNT, MIN, MAX etc.
I could do it as a UNION I suppose but then I have the problem of formatting the totals line, and this wouldn't really work for break groups, only a grand total.
Any ideas?
SteveYou might want to look into the CUBE, ROLLUP and GROUPING SETS (OLAP) extensions to the GROUP BY clause in SQL. They generate intermediate subtotals, break totals, grand totals, etc using plain SQL.
Here is a quick example of what I mean
http://htmldb.oracle.com/pls/otn/f?p=24317:190
I have chosen to use SUM(SAL), AVG(COMM) and MAX(SAL) as the aggregates, you can modify this as per your requirements.
The query is
select
empno,ename,job,deptno,
sum(sal) sum_sal,
avg(comm) avg_comm,
max(sal) max_sal
from emp
group by rollup(empno,ename,job,deptno)
having grouping_id(empno,ename,job,deptno) in (0,15)The GROUPING_ID gives a binary "bitmap" of which columns are showing a detail row vs. a aggregate/super-aggregate row. In this case, we want to show the lowest level of detail (0) and the highest grand total (15=binary 1111 or all bits turned on)
Again, you can tweak this to show intermediate subtotals, just take out that HAVING clause to see what you get and modify as needed.
Hope this helps.
Message was edited by:
Vikas -
[RESOLVED] Flag Lowest/Leaf Level in multi-dimensions
Sample Data: http://www.sendspace.com/file/uwjz9p
Hi,
I'm having issue by flagging lowest/leaf level for CUBE rollup purpose, due to there's no parent or child relationship parameter table, thus the is_leaf / connect by function cannot be use :(
However it is pretty obvious to be differentiate because the data is at follow:
1
1.2
1.2.1
1.2.2
1.3
But when mixed up two or more columns it is very hard to flag the lowest level flag.
LOWEST_FG COL_A COL_B COL_C
N - 1
N - 1.2
Y - 1.2.1 - 1.1
N - 1.2.1 - 1.2
Y - 1.2.1 - 1.2.1
Y - 1.2.1 - 1.2.2
N - 1.2.1 - 1.2.2 - 1
Y - 1.2.1 - 1.2.2 - 1.1
Y - 1.2.1 - 1.2.2 - 1.2
N - 1.2.1 - 1.2.3
Y - 1.2.1 - 1.2.3.1
Y - 1.2.2
Y - 1.3 - 1.1
Y - 1.3 - 1.2
Y - 1.3 - 1.3.1
Y - 1.3 - 1.3.2
Y - 1.3 - 1.3.3 - 1.1
Y - 1.3 - 1.3.3 - 1.2
Y - 1.3 - - 1.1
N - 1.3 - - 1.2
Y - 1.3 - - 1.2.1
Y - 1.3 - - 1.2.2
Y - 1.3 - - 1.3.2
Edited by: Sphenix on 14-Sep-2012 10:16
Edited by: Sphenix on 14-Sep-2012 10:21
SAMPLE DATA
-- DDL for Table SAMPLE_LOWEST_FG_02
CREATE TABLE "DBO"."SAMPLE_LOWEST_FG_02"
( "LVL_ID" VARCHAR2(20 BYTE),
"CUST_ID" VARCHAR2(10 BYTE),
"CORP_ID" VARCHAR2(10 BYTE),
"PURPOSE_ID" VARCHAR2(10 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ;
SAMPLE DATA
REM INSERTING into DBO.SAMPLE_LOWEST_FG_02
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2.1',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2.2',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.2.3',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.1',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.2',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.3.99',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.1.99',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2','9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2','2',null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'5.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'5.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'7');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'8');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,'9');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2',null,null);
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','1.1.3.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','1.1.3.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','1.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.5');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.1.1.6');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.2.1.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.2.1.4');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','3.2.1.99');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','4.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','4.2.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','4.2.1.1');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','4.2.1.2');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','4.3');
Insert into DBO.SAMPLE_LOWEST_FG_02 (LVL_ID,CUST_ID,CORP_ID,PURPOSE_ID) values ('1.1','1.3.2.2.1','2','5.2');
Edited by: SHi,
Sphenix wrote:
Sample Data: http://www.sendspace.com/file/uwjz9p
Post the sample data (CREATE TABLE and INSERT statements) and requirements right in your message. If that information is already availabel on some other web page or file, it should be easy for you to copy and paste it.
Hi,
I'm having issue by flagging lowest/leaf level for CUBE rollup purpose, due to there's no parent or child relationship parameter table, thus the is_leaf / connect by function cannot be use :(Acutally, the data you posted (if I interpret it correctly) does have a parent-child relationship: '1' is the parent of '1.x' , where x is any number. You could use CONNECT BY and CONNECT_BY_ISLEAF, but I think it will be more efficient to use a semi-join (as shown below) or an EXISTS sub-query.
However it is pretty obvious to be differentiate because the data is at follow:Different things are obvious to different people. Even if you and I agree that the results are obvious, we might disagree on what those results are. Say what you want.
I'm guessing you want something like this:
SELECT p.*
FROM table_x p
LEFT OUTER JOIN table_x c ON c.col_a LIKE p.col_a || '.%'
OR ( c.col_a = p.col_a
AND c.col_b LIKE p.col_b || .%'
OR ( c.col_a = p.col_a
AND c.col_b = p.col_b
AND c.col_c LIKE p.col_c || '.%'
WHERE c.col_a IS NULL
;This assumes that col_a can not be NULL.
If you'd post CREATE TABLE and INSERT statements for the sample data, then I could test this.
Edited by: Frank Kulash on Sep 14, 2012 5:37 PM -
Summarising without temporary tables
Can you please help me out with this question:
I have a table containing the following attributes and data:
EquipInfo(
EquipmentID Number,
AbnormalityID Number,
NumOfOccurances Number
I have the following data in the table:
EquipmentID AbnormalityID NumOfOccurances
1 1 7
1 8 3
1 9 2
2 4 8
3 2 4
3 4 1
Now I need a cursor that returns the following information:
EquipID TotalAbn Description
1 12 7 of type 1, 3 of type 2, 2 of type 9
2 8 8 of type 4
3 5 4 of type 2, 1 of type 4
The restriction imposed was not to use temporary tables because the client doesn't permit us to interfere with their temporary tablespaces.
I need some guidance to proceed on accomplishing this objective using stored procedures and looping constructs available.
Can this be achieved using subqueries, CUBE/ROLLUP operations?
Can you please help me out on this issue?The first two columns in your result set can be derived just using the SUM aggregrate function:
select equipmentid, sum(numofoccurances) totalabn
from equipinfo
group by equipmentid;For the third column (description), you will need to write a PL/SQL function that takes an equipmentid as a parameter, loops through the associated rows and builds a string. Something like:
create or replace function ab_function
(p_equipment_id in equipinfo.equipmentid%type)
return varchar2
is
v_result varchar2(4000);
begin
for r in (select numofoccurances, abnormalityid
from equipinfo
where equipmentid = p_equipmentid) loop
v_result := v_result || ', ' || r.numofoccurances || ' of type ' || r.abnormalityid;
end loop
return (ltrim(v_result, ', '));
end;
/And then refer to this function in your select:
select equipmentid, sum(numofoccurances) totalabn, ab_function(equipmentid) description
from equipinfo
group by equipmentid; -
Why has CAST(FieldName to float) failed in view but not in SELECT?
I've just solved a problem but I'm still not sure what the problem is!
I have a data (staging) table with all values stored as text. The data is converted to the correct data-type and also aggregated somewhat in a view. A select statement with the conversion works. A select statement with the conversion and aggregation (GROUP
BY) works. Creating a view of the conversion and aggregation works. However, on selecting from the view (e.g. SELECT TOP 1000 * FROM ViewName) it fails saying it cannot convert from varchar to float. There are no visible characters in the field apart from
numbers between 0 and 9, a decimal point and sometimes a leading minus sign (-).
The fix? Cast to money and then cast to float.
The problem? I don't know! What was the problem? Some of the values had up to 10 decimal places. Was that a problem? Was it really an overflow error masquerading as conversion error? The longest strings present were:
-2.609763091
-0.082456066
-0.674010546
-2.563428427
-0.016109637
-0.313600766
-0.104452264
-0.853811384
-0.302529502
-0.000362354
-0.002961949
-0.319269185
-0.001970796
Would really like to know what caused this so I can spot it in future before it happens.
Cheers.
JCEHOne possibility is that the two execution plans are different. The logical order of the way SQL processes the clauses a SELECT query is FROM, ON, OUTER, WHERE, GROUP BY, CUBE | ROLLUP, HAVING, SELECT, DISTINCT, ORDER BY, TOP. (Actually that's
what I learned, now there are some additional things like APPLY, but for our purposes we can ignore them). The important thing to know is that that is the LOGICAL order, but SQL is allowed (and often does) go change that order to anything it wants as
long as it returns the correct result.
So, for example, if your FROM clause a number of rows and some of those rows contain data which would cause a CAST (or anything else) in the SELECT clause to fail, but those rows are eliminated by your WHERE clause. Then SQL could do
FROM, WHERE, SELECT and the query works, or
FROM, SELECT, WHERE and the query fails. And, in general, you cannot control which plan SQL will use.
So, for example, if you have a table named T with two integer columns I and J and some rows in the table have a value of 0 in the column J and you run
SELECT I/J FROM T WHERE J<>0
it might work and you might get a divide by zero error. So one safe way to handle this is to write your query as
SELECT I/(CASE WHEN J <> 0 THEN J ELSE NULL END) WHERE J<>0
Another way would be to create a temp table and write an insert statement that inserted into that temp table only the rows where J<>0 and then do the query from the temp table. Since that is two SQL commands, SQL is forced to do them in order,
it cannot combine them and reorder the processing, that would look like
Create Table #T(I int, J int);
Insert Table #T(I, J)
Select I, J FROM T WHERE J<>0;
Select I/J From #T;
Drop Table #T;
You could try doing the equivalent of one of those to your query and see if that makes the problem go away.
Now I know you are going to ask "Why did the view use to work and it doesn't anymore?" and "Why does using the view and the table return different results". My guess is that you are getting different plans for the view and the table,
why that is, I don't know, it is often difficult to answer that type of question. My best guess for why the view used to work, then you ALTERED it, and then changed it back to the original form and it fails even though it is exactly the same as the old
view that was working is, when you had the old view, then was a cached execution plan that was working. That execution plan might have been created a good while ago. When you ALTERED it, you, of course, got a new plan. Then when you ALTERED
it back to the original form, it no longer had the plan it had been using, so had to create a new one, and this new plan was different than the old one.
Finally, if this is the cause of your problem, then you are not guaranteed that the convert to money, then to float is a permanent fix. If you have column headers which cannot be converted to either money or float, then it could be the convert to money
then to float is enough to get SQL to do the WHERE first, then the SELECT. But there is no guarantee that will be true forever. Changes in your data distribution and release level of SQL might make that version do the select first and then the
where.
Tom
Maybe you are looking for
-
External drive filling up with TM
I set up TM a few days ago and have been very happy with it until tonight when I realised that my external disk is filling up very quickly. Let me explain... I have a 320GB Lacie disk with about 300GB actually available to use. After my first TM back
-
How to use union statement with declare & set function?
Hi Experts, i have small query about how to use union statement with declare & set function? Example as below : DECLARE @name AS date Declare @name2 AS date /* SELECT FROM [2013].[dbo].[OINV] T0 */ /* WHERE */ SET @name = /* T0.DocDate */ '
-
Convert RGB to hex!! (Help!)
Hello programmers, i've have a problem... i get the rgb values of a color easily by getRGB() or getRed(),.... but do not know how to convert them (Example 255,255,255)to #rrggbb value (hexadecimal value)(like in photoshop)... can anyone help me in fi
-
IPhoto Calendar - International Shipping with US Billing Address?
I would like to send a calendar I'm making in iPhoto as gifts to friends around the world. Can I make the purchases using my US based credit card? For example I go to preferences -> advanced and change my store to Singapore (to ship to a friend in
-
Consolidated libary, now libary has disappeared! help!
I have an Iphone and my husband has a nano, we run them both from the same computer under different user names. Been doing this for a long time with no problems, then decided it would be nice to be able to share music between accounts. To do this I l