Group using the order of rows
Hi allone of my friends asked me a question and I think it's possible but how?
without using PLSQL, can it be done by sql?
We have a table and its data like this:
X Y
----------
A S
B S
C S
D T
E T
F S
G S
H R
I want to order these data be field X (which is already happening in this example) and aggregate that data by field Y but if in the order of the value of the field changes, it means that it will be a new group.I mean, for this example, A, B and C Archives is a group, D, and E are another group and E and F are one group to another. as you see ABC records and EF has same value Y (which is S) but I would like to assume they are different groups because of the order.
If I give a number of groups, it looks like this:
X Y
----------
A S 1
B S 1
C S 1
D T 2
E T 2
F S 3
G S 3
H R 4
I have 4 different group here. any idea?PS: we do not want just sql, plsql
If you don't care about the group being sequential numbers:
with t as (
select 'A' x,'S' y from dual union all
select 'B','S' from dual union all
select 'C','S' from dual union all
select 'D','T' from dual union all
select 'E','T' from dual union all
select 'F','S' from dual union all
select 'G','S' from dual union all
select 'H','R' from dual
)
select x,
y,
row_number() over(order by x) - row_number() over(partition by y order by x) rn
from t
order by x
/
X Y RN
- - ----------
A S 0
B S 0
C S 0
D T 3
E T 3
F S 2
G S 2
H R 7
8 rows selected.
SQL>
SY.
Tags: Database
Similar Questions
-
Activate search resource group using the string key
Hi all
RIM has provided APIs (Resource Bundle) to support the localization of the applications. We are able to use it
ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME).getString(key);
He expects int key and generated dynamically by Blackberry. There are 2 cases.
- Local labels, we are aware and we can provide keys for those who, for the latter is no problem.
- From backend error codes. This is not a definitive list. This is the string value. But we cannot find the resource group by using this key of type string. We have to check what the error code and create the key to this and allows to retrieve the label.
if(errorCode.equals("SOME_ERROR_CODE"){ Dialog.alert(LanguageResource.getString(SOME_ERROR_CODE)); } else if (errorCode.equals("ANOTHER_ERROR_CODE"){ Dialog.alert(LanguageResource.getString(ANOTHER_ERROR_CODE));}
To avoid this check, we thought that if this was possible.
String msg = LanguageResource.getString("SOME_ERROR_CODE")); if (msg == null) // Label not found Dialog.alert(LanguageResource.getString("GENERAL_ERROR"); else Dialog.alert(msg);
Now, API provides no support for this, is the solution to create the own property file and load them but I think that the Blackberry does support playback of the file as Java Standard properties or may be something else. The same reflection API is not supported in Blackberry up to now, there may be support in the future. This could allow to dynamically use the variable as the key name.
Someone did it faced simular situation and made a work around? All entries would help.
Kind regards
Sandeep
Edited: updated information on option of the reflection API.
It will never take in charge of reflection as the baseline for BB Os is J2ME and therefor java 1.3/1.4
you will have to translate the error to the resource key string yourself.
-
Cannot create groups using the API
Hello
I have an approval workflow for the creation of a new organization and it works fine. Once the final level of approval is finished, I should create a new org and three groups within the IOM. My adapter creates the new organization successfully. However, I get exception when I try to create groups. Is someone can you please tell me what is the question. I assigned all group permissions to the users group on the approval of the application. Here is the snippet of code with the exception I get:
HashMap < String, String > orgMap = new HashMap < String, String > ();
orgMap.put ("Organizations.Organization name", orgName);
orgMap.put ("Organizations.Type", "Organization");
long orgKey = orgOper.createOrganization (orgMap);
System.out.println ("new agency created");
HashMap < String, String > groupMap = new HashMap < String, String > ();
groupMap.put ("Groups.Group name" orgName + "Admin");
long adminGroupKey = groupOper.createGroup (groupMap); -It's the line, I get the following exception
CREATENEWORG running
= Class Security.iam.identity.adapters.tasks.CreatePartnerOrg target
Initializing class
New agency created
ERROR, March 8, 2011 16:52:10, 660, [XELLERATE. SERVER], class/method: tcDataObj/eventPreInsert error: Insert permission is denied
ERROR, March 8, 2011 16:52:10, 661, [XELLERATE. API], class/method: tcGroupOperationsBean/createGroup some problems: maoRejections: you are not allowed to insert this object.
Thor.API.Exceptions.tcAPIException: You are not allowed to insert this object.
Thank you
PETREAWhich user do you use?
Config ConfigurationClient.ComplexSetting = ConfigurationClient.getComplexSettingByPath ("Discovery.CoreServer");
final Hashtable env = config.getAllSettings ();
tcSignatureMessage moSignature = tcCryptoUtil.sign ("xelsysadm", "PrivateKey");
tcUtilityFactory utilFactory = new tcUtilityFactory (env, moSignature); -
The group using the external table name
Hello
I used the following link and I was able to create groups based on these steps. However I have a question, in the initialization block SQL SQL has a variable name,
Select "GROUP «groupname...»» ». How is the presentation layer knows that the name of the variable 'GROUP' is attributed to membership in a group? Thank you.
http://obieeblog.WordPress.com/2009/06/18/OBIEE-security-enforcement-%E2%80%93-external-database-table-authorization/Griup is a session of the system variable. As soon as you crush with block values init, same value will be overwritten at each location.
Kind regards
Sandeep -
How to use the order by clause
Hi Al
order_tracker1 is a tabular_block that I use this to search I want to order by when I search by serch_value
Please guide
The code given is used to find
declare
l_where varchar2 (4000);
Start
If: search_type = "ALL" then
l_where: = ' id | party_name | COMMENT1 | del_date like "%' | : serch_value | » %''' ;
on the other
l_where: =: search_type |' as "%' | : serch_value | » %''';
end if;
set_block_property ('order_tracker1', default_WHERE, l_where);
go_block ('order_tracker1');
execute_query;
end;
Thanks and greetings
Vikas SinghalHai,
Change the line set_block_property ('order_tracker1', default_WHERE, l_where); TO
set_block_property ('order_tracker1', default_WHERE, l_where |) "order by serch_value");
or in time design, you can give in the palette of the ORDER BY Clauesproperty.
or you can write to set_block_property (ORDER_BY, 'order_tracker1', 'serch_value');
Kind regards
Manu.
If this answer is useful or appropriate, please mark. Thank you.
-
How to use the "Order by" clause dynamically on values LOV Forms 10g r2
Hello
I have following requirement, please guide me.
1. create a list of values with 2 fields, Code and Description
2. do not use the command clause contained in the registration request Group
3. fix this LOV on a form field
4. when the user calls the user LOV will see two fields in LOV with header as Code and Description
5. when the user clicks the column header "Code" then LOV should be arranged on Code
6 and if the user clicks on the header of the column "Description" then LOV must be sorted on the Description
Thanks in advance.Please post this problem in this forum->
[Formulas Forum | http://forums.oracle.com/forums/forum.jspa?forumID=82]
And close this thread by he scored as replied. ;)
Kind regards.
LOULOU.
-
How to get rid of repeat groups using the query? Its my sql script.
Mr President.
worm of Oracle's 10g express edition
I want to get rid of repeating groups and wants to get result like
If my table script is as below
BEGIN -- drop tables EXECUTE IMMEDIATE 'DROP TABLE CUSTOMER'; EXECUTE IMMEDIATE 'DROP TABLE PRODUCT'; EXECUTE IMMEDIATE 'DROP TABLE SUPPLIER'; EXECUTE IMMEDIATE 'DROP TABLE PURCHASE'; EXECUTE IMMEDIATE 'DROP TABLE PURCHASELINE'; EXECUTE IMMEDIATE 'DROP TABLE SALES'; EXECUTE IMMEDIATE 'DROP TABLE SALESLINE'; EXECUTE IMMEDIATE 'DROP TABLE STOCK'; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(''); END; / CREATE TABLE CUSTOMER ( cust_id NUMBER NOT NULL , name VARCHAR2(50) NOT NULL , address VARCHAR2(100) DEFAULT NULL , contactno VARCHAR2(20) DEFAULT NULL , CONSTRAINT CUSTOMER_PK PRIMARY KEY ( cust_id ) ENABLE ); CREATE TABLE PRODUCT ( prod_id NUMBER NOT NULL , name VARCHAR2(50) NOT NULL , description VARCHAR2(50) DEFAULT NULL , CONSTRAINT PRODUCT_PK PRIMARY KEY ( prod_id ) ENABLE ); CREATE TABLE SUPPLIER ( suplr_id NUMBER NOT NULL , name VARCHAR2(50) NOT NULL , address VARCHAR2(100) DEFAULT NULL , contactno VARCHAR2(20) DEFAULT NULL , CONSTRAINT SUPPLIER_PK PRIMARY KEY ( suplr_id ) ENABLE ); CREATE TABLE PURCHASE ( pur_id NUMBER NOT NULL , pur_date DATE NOT NULL , suplr_id NUMBER DEFAULT '0' , CONSTRAINT PUR_SUPLR_FK FOREIGN KEY ( suplr_id ) REFERENCES SUPPLIER ( suplr_id ) , CONSTRAINT PURCHASE_PK PRIMARY KEY ( pur_id ) ENABLE ); CREATE TABLE PURCHASELINE ( pur_id NUMBER DEFAULT '0' NOT NULL , prod_id NUMBER DEFAULT '0' NOT NULL , pur_qty NUMBER DEFAULT '0' NOT NULL , unit_pur_price NUMBER DEFAULT '0' NOT NULL , CONSTRAINT PUR_LINE_PUR_FK FOREIGN KEY ( pur_id ) REFERENCES PURCHASE ( pur_id ) , CONSTRAINT PUR_LINE_POD_FK FOREIGN KEY ( prod_id ) REFERENCES PRODUCT ( prod_id ) , CONSTRAINT PUR_LINE_PK PRIMARY KEY ( pur_id,prod_id ) ENABLE ); CREATE TABLE SALES ( sal_id NUMBER NOT NULL , sal_date DATE DEFAULT NULL , cust_id NUMBER DEFAULT '0' , CONSTRAINT PUR_CUSTR_FK FOREIGN KEY ( cust_id ) REFERENCES CUSTOMER ( cust_id ) , CONSTRAINT SALES_PK PRIMARY KEY ( sal_id ) ENABLE ); CREATE TABLE SALESLINE ( sal_id NUMBER DEFAULT '0' NOT NULL , prod_id NUMBER DEFAULT '0' NOT NULL , sal_qty NUMBER DEFAULT '0' NOT NULL , unit_sal_price NUMBER DEFAULT '0' NOT NULL , CONSTRAINT SAL_LINE_SAL_FK FOREIGN KEY ( sal_id ) REFERENCES SALES ( sal_id ) , CONSTRAINT SAL_LINE_POD_FK FOREIGN KEY ( prod_id ) REFERENCES PRODUCT ( prod_id ) , CONSTRAINT SAL_LINE_PK PRIMARY KEY ( sal_id,prod_id ) ENABLE ); CREATE TABLE STOCK ( prod_id NUMBER NOT NULL , prod_qty NUMBER DEFAULT '0' NOT NULL , re_ord_level NUMBER DEFAULT '0' NOT NULL , CONSTRAINT STOCK_POD_FK FOREIGN KEY ( prod_id ) REFERENCES PRODUCT ( prod_id ) , CONSTRAINT STOCK_PK PRIMARY KEY ( prod_id ) ENABLE ); SET DEFINE OFF; -- ***** Populate Tables ***** --CUSTOMER table data INSERT INTO CUSTOMER VALUES(1,'Kamrul Hasan','Moghbazar, Dhaka','0456789123'); INSERT INTO CUSTOMER VALUES(2,'Rabiul Alam','Motijheel, Dhaka','0567891234'); INSERT INTO CUSTOMER VALUES(3,'Shahed Hasan','2-G/1,2-2,Mirpur, Dhaka','0678912345'); --PRODUCT table data INSERT INTO PRODUCT VALUES(1,'RAM',NULL); INSERT INTO PRODUCT VALUES(2,'DVD Drive',NULL); INSERT INTO PRODUCT VALUES(3,'HDD','160 GB Satta'); INSERT INTO PRODUCT VALUES(4,'Monitor','LCD 19\"'); INSERT INTO PRODUCT VALUES(5,'Printer','HP Color'); INSERT INTO PRODUCT VALUES(6,'Keyboard','Multimedia Keyborad (Customised)'); INSERT INTO PRODUCT VALUES(7,'Mouse','Customised Mouse'); -- SUPPLIER table data INSERT INTO SUPPLIER VALUES(1,'Salam Enterprise','2-H/1-10, Mirpur, Dhaka, Bangladesh','0123456789'); INSERT INTO SUPPLIER VALUES(2,'ABC Supplies','Dhanmondi, Dhaka','0234567891'); INSERT INTO SUPPLIER VALUES(3,'XYZ Company','52 Gabtali, Dhaka','0345678912'); --PURCHASE table data INSERT INTO PURCHASE VALUES(1,TO_DATE('12-12-2007','dd-mm-yyyy'),1); INSERT INTO PURCHASE VALUES(2,TO_DATE('13-12-2007','dd-mm-yyyy'),2); INSERT INTO PURCHASE VALUES(3,TO_DATE('13-12-2007','dd-mm-yyyy'),1); INSERT INTO PURCHASE VALUES(4,TO_DATE('14-12-2007','dd-mm-yyyy'),1); INSERT INTO PURCHASE VALUES(5,TO_DATE('15-12-2007','dd-mm-yyyy'),2); INSERT INTO PURCHASE VALUES(6,TO_DATE('20-12-2007','dd-mm-yyyy'),3); INSERT INTO PURCHASE VALUES(7,TO_DATE('05-01-2007','dd-mm-yyyy'),2); INSERT INTO PURCHASE VALUES(8,TO_DATE('06-05-2007','dd-mm-yyyy'),3); INSERT INTO PURCHASE VALUES(9,TO_DATE('15-07-2008','dd-mm-yyyy'),1); --PURCHASELINE table data INSERT INTO PURCHASELINE VALUES(1,1,25,900); INSERT INTO PURCHASELINE VALUES(1,2,10,1700); INSERT INTO PURCHASELINE VALUES(1,3,10,5000); INSERT INTO PURCHASELINE VALUES(1,4,9,5500); INSERT INTO PURCHASELINE VALUES(1,7,100,250); INSERT INTO PURCHASELINE VALUES(2,3,15,5000); INSERT INTO PURCHASELINE VALUES(2,6,20,500); INSERT INTO PURCHASELINE VALUES(3,6,25,450); INSERT INTO PURCHASELINE VALUES(4,7,100,200); INSERT INTO PURCHASELINE VALUES(5,5,10,3450); INSERT INTO PURCHASELINE VALUES(5,6,10,180); INSERT INTO PURCHASELINE VALUES(6,1,15,900); --SALES table data INSERT INTO SALES VALUES(1,TO_DATE('12-12-2007','dd-mm-yyyy'),2); INSERT INTO SALES VALUES(2,TO_DATE('15-12-2007','dd-mm-yyyy'),3); INSERT INTO SALES VALUES(3,TO_DATE('20-12-2007','dd-mm-yyyy'),2); INSERT INTO SALES VALUES(4,TO_DATE('28-12-2007','dd-mm-yyyy'),3); INSERT INTO SALES VALUES(5,TO_DATE('05-01-2008','dd-mm-yyyy'),1); INSERT INTO SALES VALUES(6,TO_DATE('12-01-2008','dd-mm-yyyy'),3); INSERT INTO SALES VALUES(7,TO_DATE('12-02-2008','dd-mm-yyyy'),1); INSERT INTO SALES VALUES(8,TO_DATE('12-02-2008','dd-mm-yyyy'),2); INSERT INTO SALES VALUES(9,TO_DATE('12-02-2008','dd-mm-yyyy'),3); --SALESLINE table data INSERT INTO SALESLINE VALUES(1,1,3,1000); INSERT INTO SALESLINE VALUES(1,3,1,5500); INSERT INTO SALESLINE VALUES(1,4,1,6000); INSERT INTO SALESLINE VALUES(1,6,2,500); INSERT INTO SALESLINE VALUES(1,7,2,200); INSERT INTO SALESLINE VALUES(2,2,2,1900); INSERT INTO SALESLINE VALUES(2,7,2,200); INSERT INTO SALESLINE VALUES(3,4,1,5500); INSERT INTO SALESLINE VALUES(4,2,1,2200); INSERT INTO SALESLINE VALUES(5,6,1,300); INSERT INTO SALESLINE VALUES(5,7,2,250); INSERT INTO SALESLINE VALUES(6,6,1,300); INSERT INTO SALESLINE VALUES(6,7,3,180); INSERT INTO SALESLINE VALUES(7,1,2,1000); INSERT INTO SALESLINE VALUES(7,2,1,1900); INSERT INTO SALESLINE VALUES(7,3,2,5500); INSERT INTO SALESLINE VALUES(8,4,1,5500); INSERT INTO SALESLINE VALUES(8,6,2,300); INSERT INTO SALESLINE VALUES(8,7,1,200); INSERT INTO SALESLINE VALUES(9,1,3,1000); INSERT INTO SALESLINE VALUES(9,3,2,5500); INSERT INTO SALESLINE VALUES(9,5,2,1000); --STOCK table data INSERT INTO STOCK VALUES(1,200,15); INSERT INTO STOCK VALUES(2,25,10); INSERT INTO STOCK VALUES(3,40,10); INSERT INTO STOCK VALUES(4,20,10); INSERT INTO STOCK VALUES(5,10,10); INSERT INTO STOCK VALUES(6,50,20); INSERT INTO STOCK VALUES(7,150,20); COMMIT;
Concerning
I could not figure out how you pulled your expected results, especially the last column. I guess that your problem I have several prod_id table productline / salesline. If a group of prod_id in these table should solve your problem. Something like that
SQL> select p.prod_id as product_prod_id 2 , p.name as product_name 3 , p.description as product_description 4 , s.prod_qty as stock_prod_qty 5 , s.re_ord_level as stock_re_ord_level 6 , pl.pur_qty as purchaseline_pur_qty 7 , pl.unit_pur_price as purchaseline_unit_pur_price 8 , sl.sal_qty as salesline_sal_qty 9 , sl.unit_sal_price as salesline_unit_sal_price 10 from product p 11 join stock s 12 on p.prod_id = s.prod_id 13 join ( 14 select prod_id 15 , sum(pur_qty) pur_qty 16 , sum(unit_pur_price) unit_pur_price 17 from purchaseline 18 group 19 by prod_id 20 ) pl 21 on p.prod_id = pl.prod_id 22 join ( 23 select prod_id 24 , sum(sal_qty) sal_qty 25 , sum(unit_sal_price) unit_sal_price 26 from salesline 27 group 28 by prod_id 29 ) sl 30 on p.prod_id = sl.prod_id 31 order 32 by p.prod_id; PRODUCT_PROD_ID PRODUCT_NAME PRODUCT_DESCRIPTION STOCK_PROD_QTY STOCK_RE_ORD_LEVEL PURCHASELINE_PUR_QTY PURCHASELINE_UNIT_PUR_PRICE SALESLINE_SAL_QTY SALESLINE_UNIT_SAL_PRICE --------------- -------------------- ---------------------------------------- -------------- ------------------ -------------------- --------------------------- ----------------- ------------------------ 1 RAM 200 15 40 1800 8 3000 2 DVD Drive 25 10 10 1700 4 6000 3 HDD 160 GB Satta 40 10 25 10000 5 16500 4 Monitor LCD 19\" 20 10 9 5500 3 17000 5 Printer HP Color 10 10 10 3450 2 1000 6 Keyboard Multimedia Keyborad (Customised) 50 20 55 1130 6 1400 7 Mouse Customised Mouse 150 20 200 450 10 1030 7 rows selected.
-
How to check for charts grouped using the FrameMaker API?
I have a page with bundled graphics frame and also other graphic objects that are not consolidated or are grouped into a different set. How can I check if all the objects in an image are grouped in one package?
Michael is correct. Specifically, the graphics have a FP_GroupParent property, which returns the ID of the FO_Group object that the graphic is in (if any). If the graph is not grouped, I believe that this property returns a value of zero. Thus, all graphics within a group will have the same value for FP_GroupParent.
Note that you can combine both groups, which then makes things much more complicated. A FO_Group object also has a FP_GroupParent property that theoretically allows an unlimited amount of group nesting. I hope that you don't have to deal with that.
Russ
-
-
Behavior on the order of the selected line group
When you use a GROUP BY clause with one or several columns, the results will be in the sorted order of GROUP columns (default) or we will use the ORDER BY clause?Hello!
Use ORDER BY, GROUP BY my using an algorithm of hash, so not necessarily rows will be sorted appropriately.
/ Jaroslaw Tajcher
-
without the use of order by and connect by clause
Hi all
can I write a tree query without using a start with clause and connect by clause
and
can I order the names used in a select query without using the order by clause
those things are possible in the select...dipuna wrote:
Hi allcan I write a tree query without using a start with clause and connect by clause
I think that no.
can I order the names used in a select query without using the order by clause
No.Why you do not want to use order by clause?
-
Error when using the no_lig function in forms6i
Oracle forms6i
Hai
When you use the function num row in my forms, I got an error.
My code is
declare
pin_no varchar2 (16);
date of pin_date;
pin_time varchar2 (25);
Ilan varchar2 (200);
m_file TEXT_IO. TYPE_DE_FICHIER;
m_file_path varchar2 (100): =: global.filename;
number of line_count;
M_BARCODE VARCHAR2 (16);
DATE OF M_BARDATE;
M_BARTIME varchar2 (25);
Number of M_No;
Cursor c1 is
Select the code bars, bardate, bartime,
ROW_NUMBER() (partition by bartime barcode order): nurse - the error on this line
of temp_attendance
Group of barcodes, bardate, bartime
order by bardate;
Start
If m_file_path is not null then
m_file: = TEXT_IO.fopen (m_file_path, 'r');
-ELIMINATION OF temp_attendance;
Loop
Start
TEXT_IO.get_line (m_file, Mstr);
MSTR: = ltrim (rtrim (mstr));
M_barcode: = substr (mstr, 1, 16);
M_bardate: is to_date (substr (mstr, 17, 8), ' DD/MM/YYYY');.
M_bartime: = (substr (mstr, 25, 4));
INSERT INTO temp_attendance (BARCODE, BARDATE, BARTIME, RN) VALUES(M_BARCODE,M_BARDATE,M_BARTIME,M_No);
Exception
When no_data_found then
TEXT_IO.fclose (m_file);
"exit";
End;
End loop;
go_block ('TEST_MS1');
clear_block (no_validate);
To r1 c1 loop
: bar code: = r1.barcode;
: bardate: = r1.bardate;
: bartime: = r1.bartime;
next_Record;
end loop;
premier_enregistrement;
end if;
exception
while others then
forms_ddl ('ROLLBACK');
message (sqlerrm);
end;
Thanks and greetings
Srikkanth.M6i u cannot use this type of analytical functions... motor of PL/SQL forms 6i is 8.0
Bangoura
[My Oracle Blog | http://baigsorcl.blogspot.com/] -
How to change the order for table?
I use oracle 10g 10.2.0.3.0
I have a select statement
and explain the Plan showsSELECT /*+ leading v.Guest_Info v.Guest_Domain_Relation Guest_Address*/ * FROM (SELECT Cdr.Guest_Domain_Relation_Id, Ci.Guest_Id FROM Guest_Info Ci, Guest_Domain_Relation Cdr WHERE Ci.Guest_Id = Cdr.Guest_Id) v, Guest_Address Ca WHERE v.Guest_Id = Ca.Guest_Id;
Is there in any case, I have Guess_Domain_Relation table join firstly that the join to Guess_Address table of Guest_info?1 Plan hash value: 3785964411 2 3 --------------------------------------------------------------------------------------------------------- 4 | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | 5 --------------------------------------------------------------------------------------------------------- 6 | 0 | SELECT STATEMENT | | 1806 | 199K| 9 (23)| 00:00:01 | 7 |* 1 | HASH JOIN | | 1806 | 199K| 9 (23)| 00:00:01 | 8 | 2 | MERGE JOIN | | 482 | 48682 | 6 (17)| 00:00:01 | 9 | 3 | TABLE ACCESS BY INDEX ROWID| Guest_ADDRESS | 919 | 87305 | 4 (0)| 00:00:01 | 10 | 4 | INDEX FULL SCAN | XAK1Guest_ADDRESS | 919 | | 1 (0)| 00:00:01 | 11 |* 5 | SORT JOIN | | 482 | 2892 | 2 (50)| 00:00:01 | 12 | 6 | INDEX FULL SCAN | XPKGuest_INFO | 482 | 2892 | 1 (0)| 00:00:01 | 13 | 7 | VIEW | index$_join$_003 | 3493 | 41916 | 3 (0)| 00:00:01 | 14 |* 8 | HASH JOIN | | | | | | 15 | 9 | INDEX FAST FULL SCAN | XAK1Guest_DOMAIN_Relation | 3493 | 41916 | 1 (0)| 00:00:01 | 16 | 10 | INDEX FAST FULL SCAN | XPKGuest_DOMAIN_Relation | 3493 | 41916 | 1 (0)| 00:00:01 | 17 --------------------------------------------------------------------------------------------------------- 18 19 Predicate Information (identified by operation id): 20 --------------------------------------------------- 21
I tried a few ways to rewrite the query, but he's no luck
Thank you
Published by: Y.L on March 20, 2013 13:59Y.L wrote:
And my another problem here... I don't know why my first clue didn't work...Probably the syntax. The main indicator uses parentheses, as
/*+ select /*+ leading(table1, table2) */ * from table1, table2 */
Remember that you must use the table alias name in tips for the identifier to be recognized
You can also consider using the y indicator (if you must use a hint) for several tables - beware, it is MUCH easier to do worse performance with this suspicion using the order of the tables in the FROM clause in left to right
/*+ select /*+ ordered */ * from table1, table2, table3 . . . */
How I create index will affect how it works?
How the index was created probably won't affect how it works. Indexes can be created using constraints and directly with the CREATE INDEX command. The creation of the index should not be as important as its defined characteristics: index type, columns, etc.
-
What's the point of having several columns in the ORDER BY clause?
DB version: 10 gr 2
When you use the ORDER BY clause, the lines are always sorted by the first column in the ORDER BY clause. So, what's the point of having several columns in the ORDER BY clause (I always see this in production codes)?
For the below SQLs' schema SCOTT, result sets are always classified according to the first column ename. When I added use asc and desc of employment, does not change the result set.
SQL> select * from emp order by ename; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 20 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7839 KING PRESIDENT 17-NOV-81 5000 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7934 MILLER CLERK 7782 23-JAN-82 1300 20 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 14 rows selected. SQL> select * from emp order by ename, job; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 20 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7839 KING PRESIDENT 17-NOV-81 5000 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7934 MILLER CLERK 7782 23-JAN-82 1300 20 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 14 rows selected. SQL> select * from emp order by ename, job desc; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 20 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7839 KING PRESIDENT 17-NOV-81 5000 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7934 MILLER CLERK 7782 23-JAN-82 1300 20 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 14 rows selected.
Search in this example, you will see the difference
SQL> create table test_order (name varchar2(10), surname varchar2(10), age number); Table created. SQL> insert into test_order values('Kamran','Agayev',26); 1 row created. SQL> insert into test_order values('Kamran','Taghiyev',26); 1 row created. SQL> insert into test_order values('John','Kevin',23); 1 row created. SQL> select * from test_order; NAME SURNAME AGE ---------- ---------- ---------- Kamran Agayev 26 Kamran Taghiyev 26 John Kevin 23 SQL> select * from test_order 2 order by age; NAME SURNAME AGE ---------- ---------- ---------- John Kevin 23 Kamran Agayev 26 Kamran Taghiyev 26 SQL> select * from test_order 2 order by age asc, surname desc; NAME SURNAME AGE ---------- ---------- ---------- John Kevin 23 Kamran Taghiyev 26 Kamran Agayev 26 SQL>
When in the second query, I sorted out only for age, you saw it there two 26 years old Keita, there was first Agayev, then Taghiyev. But if I want to get the family names in descending order when there are two very old person, then I will add the second column in the order by clause
- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev a. (10g OCP)
http://kamranagayev.WordPress.com -
The value of the PropFlags using the API
Hello
I created a new group using the c# API calls. I need to ensure that the new group is not deleted. So I tried using the SetFlag method to set these property flags.
The code snippet is as
userGroup = eng. NewUser (null);
userGroup.LoginName = "Test";
userGroup.AsPropertyObject (). Flags ("PropFlags_NotDeletable", 0x1, 0x400000);
userGroup.AsPropertyObject (). Flags ("PropFlags_NameNotEditable", 0x1, 0x400000);However, the newly created group doesn't have these flags set.
How can I go on the definition of these indicators?
Thank you
Arun
You pass incorrect arguments to the function flags. The first parameter is the string to search for the property you want to set flags on. In this case, pass an empty string to reference the user object. The second parameter specifies the options for the function. In this case you need anything. The third parameter specifies the desired flags set on the property. You must pass the combination of indicators (PropFlags_NotDeletable |) PropFlags_NameNotEditable). If you remember the flags feature, it will overwrite the flags that you set in previous calls.
userGroup.AsPropertyObject (). Flags ("", 0 x 0, PropFlags_NotDeletable |) PropFlags_NameNotEditable);
Maybe you are looking for
-
"Failed to process the backup file" - bookmarks JSON file
I deleted my appdata files without thinking and then allowed my trash. When I opened firefox again all my favorites have disappeared. I used piriform recuva to find my deleted files and recover the backup JSON files 10 bookmark. When I try to restore
-
What is the point of the 'Keywords' field in the window 'library '?
I use the tags function in the library window to help me to search through hundreds of bookmarks. It is great and very useful.But I do not understand the interest to also have a "Keywords" field.It seems to me that the keywords are not searchable why
-
What version of firefox can I use with windows me?
What version of Firefox can I use with windows me? Where can I get?
-
notbook 15-e074se: 15-e074se drivers
Hello I have this laptop (notbook 15-e074se), and it comes to its specifications: http://support.HP.com/us-en/document/c03821655 I have windows 7 and I can't install the graphics card and I have a probem @ youtube so I need the graphics and audio dri
-
[URGENT] My laptop does not light
Hello, so my Compaq Notebook 15-a003sa will not start. He also had a problem the day before as a black screen appeared, but I was able to fix it with a hard reset. This time, when I try to press the power button, the led of the wireless button flashe