How to use Alias Columns in WHERE CLAUSE
Hi ,
I have a query where in there are 2 alias columns, start_date and end_date where in i need to use them in my WHERE clause as start_date < end_date. Please let me know if this is possible. please see the bwlow query
SELECT (GREATEST (MIN (a.start_date_active),
MIN (b.start_date_active),
MIN (c.start_date_active),
d.start_date_active ) start_date ,
LEAST (MAX (NVL (a.end_date_active, b.end_date_active)),
MAX (c.end_date_active),
MAX (b.end_date_active),
NVL (d.end_date_active,'31-DEC-2099')) end_date,
c.terr_id,
a.source_number,
e.resource_id mgr_resource_id,
d.role_relate_id role_relate_id
,g.resource_id
FROM table1 a,
table5 e,
table4 d,
table6 f,
table7 g,
table8 h ,
table2 b,
table3 c,
table9 i
WHERE 1=1
AND b.resource_id = g.resource_id
AND c.terr_id = b.terr_id
AND to_number (c.attribute3) = i.party_id
AND a.source_number = UPPER (e.salesrep_number)
AND d.role_resource_type = 'RS_INDIVIDUAL'
AND e.resource_id = d.role_resource_id
AND d.role_id = f.role_id
AND (a.start_date_active <= b.end_date_active
AND (NVL (a.end_date_active, b.end_date_active) >= b.start_date_active))
AND h.resource_id = a.resource_id
AND UPPER (g.salesrep_number) = h.source_number
GROUP BY a.source_number, c.terr_id, e.resource_id,d.start_date_active,d.end_date_active,d.role_relate_id,g.resource_id
Thanks,
Lakshmi
I did not understand your query but have you tried using the HAVING clause?
HAVING clause allows you to use a "where" like condition for your groupings.
See http://www.techonthenet.com/sql/having.php for some examples.
Sandeep Gandhi
Similar Messages
-
How to use alias name in where clause
Hello,
DECODE (item.inv_type,'OT', (DECODE (item.attribute2, 'STONE', 0, xfer.release_quantity1 * xfer.attribute10)
'FG', (xfer.release_quantity1 * xfer.attribute10)
) matl_val
In the above code matl_val is alias name i need to use that one in where clause as
where matl_val > 0
is this possible or anyother way can anyone help me.But the point is as you haven't read the documentation you may miss some valuable points about alias and will soon end with another problem.
>
Specify an alias for the column expression. Oracle Database will use this alias in the column heading of the result set. The AS keyword is optional. The alias effectively renames the select list item for the duration of the query. The alias can be used in the order_by_clause but not other clauses in the query.
>
http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702 -
How to use CASE stmt in Where clause
Hi,
How to use CASE stmt in WHERE clause?. I need the code. Please send me as early as possible..........Hi,
1004977 wrote:
Hi,
How to use CASE stmt in WHERE clause?. There's no difference between how a CASE expression is used in a WHERE clause, and how it is used in any other clause. CASE ... END always returns a single scalar value, and it can be used almost anywere a single scalar expression (such as a column, a literal, a single-row function, a + operation, ...) can be used.
CASE expressions aren't needed in WHERE clauses very much. The reason CASE expressions are so useful is that they allow you to do IF-THEN-ELSE logic anywhere in SQL. The WHERE clause already allows you to do IF-THEN-ELSE logic, usually in a more convenient way.
I need the code.So do the peple who want t help you. Post a query where you'd like to use a CASE expression in the WHERE clause. Post CREATE TABLE and INSERT statements for any tables used unless they are commonly available, such as scott.emp). Also, post the results you want from that sample data, and explain how you get those resuts from that data.
See the forum FAQ {message:id=9360002}
Please send me as early as possible..........As mentioned bfore, that's rude. It's also self-defeating. Nobody will refuse to help you because you don't appear pushy enough, but some people will refuse to help you if you appear too pushy. -
Is it possible to use LONG columns in WHERE clause or ORDER BY?
Is it possible to use LONG columns in WHERE clause or ORDER BY?
Hi,
LONG data type is deprecated, maybe could you change your column type to LOB ?
Nonetheless below is a workaround which may fit your needs if forced to use LONG.
It uses a function which returns you a CLOB. It allows you to use the converted "LONG" column in a WHERE clause.
Then if you want to order by you have to convert the CLOB to a VARCHAR using DBMS_LOB.SUBSTR.
SQL> CREATE TABLE my_table (id NUMBER, description LONG);
Table created.
SQL> INSERT INTO my_table VALUES (1, 'FIRST LONG');
1 row created.
SQL> INSERT INTO my_table VALUES (2, 'ANOTHER LONG');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> CREATE TYPE my_type_row AS OBJECT (id INTEGER, description CLOB);
2 /
Type created.
SQL> CREATE TYPE my_type_table AS TABLE OF my_type_row;
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION get_my_long
2 RETURN my_type_table
3 PIPELINED
4 AS
5 v_tab my_type_table := my_type_table ();
6 BEGIN
7 FOR cur IN (SELECT id, description FROM my_table)
8 LOOP
9 PIPE ROW (my_type_row (cur.id, cur.description));
10 END LOOP;
11 RETURN;
12 END;
13 /
Function created.
SQL> SELECT
2 id,
3 description
4 FROM
5 TABLE (get_my_long ())
6 WHERE
7 description LIKE '%LONG'
8 ORDER BY
9 DBMS_LOB.SUBSTR(description);
ID DESCRIPTION
2 ANOTHER LONG
1 FIRST LONG
SQL> SELECT
2 id,
3 description
4 FROM
5 TABLE (get_my_long ())
6 WHERE
7 description LIKE 'FI%';
ID DESCRIPTION
1 FIRST LONG
SQL>Kind regards,
Ludovic -
How to use between timestamp in where clause
Hi All,
i have a colum column2 of data type timestamp.now i wants to fatch record having between two date of column2.how to use between operator in where condition having column as timespamp'Hi,
You can use a timestamp literal, or use a function that return a timestamp datatype, here is an example:
(TIMESTAMP 'YYYY-MM-DD HH24:MI:SS.FF')
select * from yourtable where column2 between TIMESTAMP '1997-01-31 09:26:50.12' and systimestampHave a look to the documentation, for example http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch4datetime.htm -
How to use case function in where clause
Hi,
Suppose a table DEMO has columns
DEMO TABLE
user_id
user_name
location
In this table i have 15 users. but out of 15 users i want to use only 5 users for passing as user_name.
then how to achieve the result
1. when i pass the particular 5 user_name in where clause then i should get all the user_name and for other 10 users it will show only the passing user_name.
how to use case functionDo you mean this ?
SQL> var name varchar2(10)
SQL> exec :name := 'ALLEN'
PL/SQL procedure successfully completed.
SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
2 else :name end = ename;
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
SQL> exec :name := 'SMITH'
PL/SQL procedure successfully completed.
SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
2 else :name end = ename;
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
SQL> exec :name := 'BLAKE'
PL/SQL procedure successfully completed.
SQL> select ename from emp where case when :name in ('SMITH','ALLEN') then ename
2 else :name end = ename;
ENAME
BLAKERgds. -
How to use string operation in where clause of select query
Hello All,
I just want to know how can i write a restriction in select query saying retrive data only begins with name "DE*".
Explaination: If my table has records and names starts with character then i want to write a query to fetch all the records in which names starts with DE*.
Thanks in advance for your quick reply...
Dev.Hi
In the where clause you need to write like
WHERE NAME LIKE 'DE%'
Regards
Sudheer -
How to use DATE in the where clause
I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
select query used to get the list of records
CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
not returning expected records
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;Edited by: Balaji on Mar 19, 2012 9:13 PMHi,
Balaji wrote:
I need to select list of records from a table where available date is greater than or equal to current date. Below is the table structure and
select query used to get the list of records
CREATE TABLE TEMP (ITEM_ID NUMBER(20),ITEM_NAME VARCHAR2(100),CREATION_DATE DATE,AVAILABLE_DATE DATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(1,'ITEM1',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(2,'ITEM2',SYSDATE,SYSDATE+10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(3,'ITEM3',SYSDATE,SYSDATE-10);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(4,'ITEM4',SYSDATE,SYSDATE);
INSERT INTO TEMP (ITEM_ID,ITEM_NAME,CREATION_DATE,AVAILABLE_DATE) VALUES(5,'ITEM5',SYSDATE,SYSDATE+5);
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date > SYSDATE OR available_date LIKE SYSDATE;
Both operands to LIKE are supposed to be strings. Don't try to use a DATE, such as SYSDATE, with LIKE.
I am getting the expected records but i am not able to find a condition where i can use *>=* for date data type, a query like the below one is
not returning expected records
SELECT ITEM_NAME, available_date FROM TEMP WHERE available_date >= SYSDATE ;
It's returning the results I expect.
If you'd say what results you were expecting, someone could help you wite a query to get them.
Assuming 1 second elapses between the time 'ITEM4' is inserted and the time the 2nd query is run, then, at run-time, available_date will be 1 second less than SYSDATE, so it should not be included.
If you want to find rows that are on the same calendar day as SYSDATE, or later, then use
WHERE available_date >= TRUNC (SYSDATE) -
How to use division with a Where() clause
I have to report four specific time periods dynamically so I made Date variables. I cannot use division of the metrics without applying the date codes to the individual metrics. There has to be a way I am not thinking of. This is a massive report so I need to keep variables to a minimum.
Example:
[Sales 1] / [Quota 1] = Percent to Quota
I have a Date Variable for Quarter to Date: [Months in QTD] That returns multiple "Fiscal Periods" (months) per date formulas
However, to get the right time period data using DIVISION, say for Quarter To Date I have to use:
[Sales 1] Where( [Fiscal Period] = [Months In QTD]) / [Quota 1] Where( [Fiscal Period] = [Months In QTD])
The above returns the correct value for the three months in the quarter.
That would be OK except I need an IF..Then..ElseIf..Else statement to solve for zeros and nulls and it gets very long adding the “Where( [Fiscal Period] = [Months In QTD])” to every measure in the statement.
I have tried nesting: =(SUM( [Sales 1] ) / Sum( [Quota 1) ) Where( [Fiscal Period] = [Months In QTD])
And that does not work as with other attempts to nest.
I tried an IF( [Fiscal Period] = [Months In QTD] … but it returns MULTI error I assume becaause the variable [Months in QTD] delivers more that one Fiscal Period.
Come on brainac’s. Division has its own rules but there should be a way.
Thank you.Hi,
Just to give you rough idea. I would suggest you to apply following logic at query level.
Create a query with prompt and try to get Months in QTD there only a single object.
Now apply filter on second query "where result from another query" that will filter data for perticular quarter.
I hope you can understand.
Thanks,
Swapnil -
How can we use DECODE function in where clause.
Hi Guys,
I have to use DECODE function in where clause.
like below
select * from tab1,tab2
where a.tab1 = b.tab2
and decode(code, 'a','approved')
in this manner its not accepting?
Can any one help me on this or any other aproach?
Thanks
-LKR>
I am looking for to decode the actual db value something in different for my report.
like if A then Accepted
elseif R then Rejected
elseif D then Denied
these conditions I have to check in where clause.
>
what are you trying to do?
may be you are looking for
select * from tab1,tab2
where a.tab1 = b.tab2
and
(decode(:code, 'A','Accepted') = <table_column>
or
decode(:code, 'R','Rejected') = <table_column>
or
decode(:code, 'D','Denied') = <table_column>
) -
Using CLOB datatypes in WHERE clause
Hi All,
I have a table with two columns as CLOB datatype. I'm using Oracle 8i Enterprise Edition. I can do a query, insert, update and even delete the data in the CLOB field using Oracle's SQL Plus.
What I want is to do a search on those fields.. that is include that field in a WHERE clause. I'm using this datatype to store large number of data.
I'd like to see this query working...
SELECT * FROM MyTable WHERE CLOBFLD LIKE 'Something...';
Now this query doesn't work. It returns: 'Inconsistent datatype' near the word CLOBFLD.
Please Help me out.
Regards,
Gopi
nullI presume you want to query based on the contents of the CLOB, right ? If that is true, then you have to create a text index, using Oracle Context and then use "Contains" in the where clause to query. Hope this helps.
-
Can I use SYSDATE in the WHERE clause to limit the date range of a query
Hi,
Basicaly the subject title(Can I use SYSDATE in the WHERE clause to limit the date range of a query) is my question.
Is this possible and if it is how can I use it. Do I need to join the table to DUAL?
Thanks in advance.
SteliosAs previous poster said, no data is null value, no value. If you want something, you have nvl function to replace null value by an other more significative value in your query.<br>
<br>
Nicolas. -
Using 2 catsearch in where clause
Hi all,
I have problem using 2 catsearch in where clause, am not sure if there is any solution this. i have created a simple test data as below:-
-- Test Code
create table cust_catalog (
id number(16),
firstname varchar2(80),
surname varchar2(80),
birth varchar2(25),
age numeric )
INSERT ALL
INTO cust_catalog VALUES ('1','John','Smith','Glasgow','52')
INTO cust_catalog VALUES ('2','Emaily','Johnson','Aberdeen','55')
INTO cust_catalog VALUES ('3','David','Miles','Leeds','53')
INTO cust_catalog VALUES ('4','Keive','Johnny','London','45')
INTO cust_catalog VALUES ('5','Jenny','Smithy','Norwich','35')
INTO cust_catalog VALUES ('6','Andy','Mil','Aberdeen','63')
INTO cust_catalog VALUES ('7','Andrew','Smith','London','64')
INTO cust_catalog VALUES ('8','John','Smith','London','54')
INTO cust_catalog VALUES ('9','John','Henson','London','56')
INTO cust_catalog VALUES ('10','John','Mil','London','58')
INTO cust_catalog VALUES ('11','Jon','Smith','Glasgow','57')
INTO cust_catalog VALUES ('12','Jen','Smith','Glasgow','60')
INTO cust_catalog VALUES ('13','Chris','Smith','Glasgow','59')
SELECT * FROM DUAL
EXEC CTX_DDL.create_index_set('cust_iset');
EXEC CTX_DDL.CREATE_PREFERENCE ('cust_lexer', 'BASIC_LEXER');
EXEC CTX_DDL.SET_ATTRIBUTE('cust_lexer', 'SKIPJOINS' , ',''."+-()/');
EXEC CTX_DDL.Create_Preference('cust_wildcard_pref', 'BASIC_WORDLIST');
EXEC CTX_DDL.set_attribute('cust_wildcard_pref', 'prefix_index', 'YES');
EXEC CTX_DDL.ADD_INDEX('cust_iset','id');
EXEC CTX_DDL.ADD_INDEX('cust_iset','birth');
EXEC CTX_DDL.ADD_INDEX('cust_iset','age');
CREATE INDEX FIRSTNAME_IDX ON cust_catalog(firstname) INDEXTYPE IS CTXSYS.CTXCAT
PARAMETERS ('index set cust_iset LEXER cust_lexer Wordlist cust_wildcard_pref');
CREATE INDEX SURNAME_IDX ON cust_catalog(surname) INDEXTYPE IS CTXSYS.CTXCAT
PARAMETERS ('index set cust_iset LEXER cust_lexer Wordlist cust_wildcard_pref');
EXEC DBMS_STATS.GATHER_TABLE_STATS('WORKAROUND', 'CUST_CATALOG', cascade=>TRUE);
-- For removing test data
drop table cust_catalog;
EXEC CTX_DDL.DROP_INDEX_SET('cust_iset');
EXEC CTX_DDL.DROP_PREFERENCE('cust_lexer');
EXEC CTX_DDL.DROP_PREFERENCE('cust_wildcard_pref');
DROP INDEX FIRSTNAME_IDX ;
DROP INDEX SURNAME_IDX ;
------- QUESTIONS IN HERE -------------------------------------------------
SELECT * FROM cust_catalog WHERE ctxsys.catsearch (firstname, 'John','age BETWEEN 40 AND 70 AND birth=''Glasgow''')>0
I have no problem running above query
BUT if i add 2 catsearch on both firstname and surname, i have error ~ catsearch does not support function invocation
SELECT * FROM cust_catalog WHERE ctxsys.catsearch (firstname, 'John','age BETWEEN 40 AND 70 AND birth=''Glasgow''')>0 AND
ctxsys.catsearch (surname, 'Smith','age BETWEEN 40 AND 70 AND birth=''Glasgow''')>0
:(The following expands the example to include the birth (as part of the multi_column_datastore) and age (using filter by during index creation and sdata in the query) and show the execution plan. I have provided the script and execution separately.
-- script:
DROP TABLE cust_catalog
EXEC CTX_DDL.DROP_PREFERENCE ('cust_lexer')
EXEC CTX_DDL.DROP_PREFERENCE ('cust_wildcard_pref')
EXEC CTX_DDL.DROP_PREFERENCE ('your_datastore')
EXEC CTX_DDL.DROP_SECTION_GROUP ('your_sec')
CREATE TABLE cust_catalog
(id NUMBER (16),
firstname VARCHAR2 (80),
surname VARCHAR2 (80),
birth VARCHAR2 (25),
age NUMERIC)
INSERT ALL
INTO cust_catalog VALUES (1, 'John', 'Smith', 'Glasgow', 52)
INTO cust_catalog VALUES (2, 'Emaily', 'Johnson', 'Aberdeen', 55)
INTO cust_catalog VALUES (3, 'David', 'Miles', 'Leeds', 53)
INTO cust_catalog VALUES (4, 'Keive', 'Johnny', 'London', 45)
INTO cust_catalog VALUES (5, 'Jenny', 'Smithy', 'Norwich', 35)
INTO cust_catalog VALUES (6, 'Andy', 'Mil', 'Aberdeen', 63)
INTO cust_catalog VALUES (7, 'Andrew', 'Smith', 'London', 64)
INTO cust_catalog VALUES (8, 'John', 'Smith', 'London', 54)
INTO cust_catalog VALUES (9, 'John', 'Henson', 'London', 56)
INTO cust_catalog VALUES (10, 'John', 'Mil', 'London', 58)
INTO cust_catalog VALUES (11, 'Jon', 'Smith', 'Glasgow', 57)
INTO cust_catalog VALUES (12, 'Jen', 'Smith', 'Glasgow', 60)
INTO cust_catalog VALUES (13, 'Chris', 'Smith', 'Glasgow', 59)
SELECT * FROM DUAL
EXEC CTX_DDL.CREATE_PREFERENCE ('cust_lexer', 'BASIC_LEXER')
EXEC CTX_DDL.SET_ATTRIBUTE ('cust_lexer', 'SKIPJOINS' , ',''."+-()/')
EXEC CTX_DDL.Create_Preference ('cust_wildcard_pref', 'BASIC_WORDLIST')
EXEC CTX_DDL.set_attribute ('cust_wildcard_pref', 'prefix_index', 'YES')
EXEC CTX_DDL.CREATE_PREFERENCE ('your_datastore', 'MULTI_COLUMN_DATASTORE')
EXEC CTX_DDL.SET_ATTRIBUTE ('your_datastore', 'COLUMNS', 'firstname, surname, birth')
EXEC CTX_DDL.CREATE_SECTION_GROUP ('your_sec', 'BASIC_SECTION_GROUP')
EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'firstname', 'firstname', TRUE)
EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'surname', 'surname', TRUE)
EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'birth', 'birth', TRUE)
CREATE INDEX context_idx
ON cust_catalog (firstname)
INDEXTYPE IS CTXSYS.CONTEXT
FILTER BY age
PARAMETERS
('DATASTORE your_datastore
SECTION GROUP your_sec
LEXER cust_lexer
WORDLIST cust_wildcard_pref')
COLUMN firstname FORMAT A10
COLUMN surname FORMAT A10
COLUMN birth FORMAT A10
SET AUTOTRACE ON EXPLAIN
SELECT * FROM cust_catalog
WHERE CONTAINS
(firstname,
'(John WITHIN firstname)
AND (Glasgow WITHIN birth)
AND (SDATA (age BETWEEN 40 AND 70))') > 0
SET AUTOTRACE OFF-- execution:
SCOTT@orcl_11gR2> DROP TABLE cust_catalog
2 /
Table dropped.
SCOTT@orcl_11gR2> EXEC CTX_DDL.DROP_PREFERENCE ('cust_lexer')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.DROP_PREFERENCE ('cust_wildcard_pref')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.DROP_PREFERENCE ('your_datastore')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.DROP_SECTION_GROUP ('your_sec')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> CREATE TABLE cust_catalog
2 (id NUMBER (16),
3 firstname VARCHAR2 (80),
4 surname VARCHAR2 (80),
5 birth VARCHAR2 (25),
6 age NUMERIC)
7 /
Table created.
SCOTT@orcl_11gR2> INSERT ALL
2 INTO cust_catalog VALUES (1, 'John', 'Smith', 'Glasgow', 52)
3 INTO cust_catalog VALUES (2, 'Emaily', 'Johnson', 'Aberdeen', 55)
4 INTO cust_catalog VALUES (3, 'David', 'Miles', 'Leeds', 53)
5 INTO cust_catalog VALUES (4, 'Keive', 'Johnny', 'London', 45)
6 INTO cust_catalog VALUES (5, 'Jenny', 'Smithy', 'Norwich', 35)
7 INTO cust_catalog VALUES (6, 'Andy', 'Mil', 'Aberdeen', 63)
8 INTO cust_catalog VALUES (7, 'Andrew', 'Smith', 'London', 64)
9 INTO cust_catalog VALUES (8, 'John', 'Smith', 'London', 54)
10 INTO cust_catalog VALUES (9, 'John', 'Henson', 'London', 56)
11 INTO cust_catalog VALUES (10, 'John', 'Mil', 'London', 58)
12 INTO cust_catalog VALUES (11, 'Jon', 'Smith', 'Glasgow', 57)
13 INTO cust_catalog VALUES (12, 'Jen', 'Smith', 'Glasgow', 60)
14 INTO cust_catalog VALUES (13, 'Chris', 'Smith', 'Glasgow', 59)
15 SELECT * FROM DUAL
16 /
13 rows created.
SCOTT@orcl_11gR2> EXEC CTX_DDL.CREATE_PREFERENCE ('cust_lexer', 'BASIC_LEXER')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.SET_ATTRIBUTE ('cust_lexer', 'SKIPJOINS' , ',''."+-()/')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.Create_Preference ('cust_wildcard_pref', 'BASIC_WORDLIST')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.set_attribute ('cust_wildcard_pref', 'prefix_index', 'YES')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.CREATE_PREFERENCE ('your_datastore', 'MULTI_COLUMN_DATASTORE')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.SET_ATTRIBUTE ('your_datastore', 'COLUMNS', 'firstname, surname, birth')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.CREATE_SECTION_GROUP ('your_sec', 'BASIC_SECTION_GROUP')
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'firstname', 'firstname', TRUE)
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'surname', 'surname', TRUE)
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> EXEC CTX_DDL.ADD_FIELD_SECTION ('your_sec', 'birth', 'birth', TRUE)
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> CREATE INDEX context_idx
2 ON cust_catalog (firstname)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 FILTER BY age
5 PARAMETERS
6 ('DATASTORE your_datastore
7 SECTION GROUP your_sec
8 LEXER cust_lexer
9 WORDLIST cust_wildcard_pref')
10 /
Index created.
SCOTT@orcl_11gR2> COLUMN firstname FORMAT A10
SCOTT@orcl_11gR2> COLUMN surname FORMAT A10
SCOTT@orcl_11gR2> COLUMN birth FORMAT A10
SCOTT@orcl_11gR2> SET AUTOTRACE ON EXPLAIN
SCOTT@orcl_11gR2> SELECT * FROM cust_catalog
2 WHERE CONTAINS
3 (firstname,
4 '(John WITHIN firstname)
5 AND (Glasgow WITHIN birth)
6 AND (SDATA (age BETWEEN 40 AND 70))') > 0
7 /
ID FIRSTNAME SURNAME BIRTH AGE
1 John Smith Glasgow 52
1 row selected.
Execution Plan
Plan hash value: 495863752
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 136 | 4 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| CUST_CATALOG | 1 | 136 | 4 (0)| 00:00:01 |
|* 2 | DOMAIN INDEX | CONTEXT_IDX | | | 4 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("CTXSYS"."CONTAINS"("FIRSTNAME",'(John WITHIN firstname)
AND (Glasgow WITHIN birth) AND (SDATA (age BETWEEN 40 AND 70))')>0)
Note
- dynamic sampling used for this statement (level=2)
SCOTT@orcl_11gR2> SET AUTOTRACE OFF -
How to use the Columns Hidden | space in the bottom of af:panelCollection?
Hi,experts,
In jdev 11.1.2.3,
I can see a row of Columns Hidden | Columns Frozen in the bottom of component af:panelCollection - pc1 which have an af:table - t1 component inside in designer view,
and can see there is a blank row space only with "|" inside when the page is running.
Now I want to use this blank row space such as to display row numbers for the table, so I set the property for the panelColletion as following source code:
==========================
<af:panelCollection id="pc1" inlineStyle="width:1250px; height:500px;">
<f:facet name="menus"/>
<f:facet name="toolbar"/>
<f:facet name="statusbar">
<af:group id="g4"/>
</f:facet>
<af:table value="#{bindings.TView1.collectionModel}" var="row"
rows="#{bindings.TView1.rangeSize}"
emptyText="#{bindings.TView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.TView1.rangeSize}" rowBandingInterval="1"
filterModel="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}" filterVisible="false"
varStatus="vs"
selectedRowKeys="#{bindings.TView1.collectionModel.selectedRow}"
selectionListener="#{bindings.TView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1" inlineStyle="font-size:xx-large; font-weight:bolder;">
<af:column sortProperty="#{bindings.TView1.hints.GoodsStatus3.name}" filterable="true"
sortable="true"
headerText="#{bindings.TView1.hints.GoodsStatus3.label}"
id="c42">
<af:outputText value="#{row.GoodsStatus3}" id="ot33"/>
</af:column>
<f:facet name="footer">
<af:group id="g3">
*<af:outputText value="RowsNumber:" id="ot44"/>*
*<af:outputText value="#{bindings.TView1Iterator.estimatedRowCount}"*
id="ot43" partialTriggers="::pc1:t1"/>
</af:group>
</f:facet><f:facet name="detailStamp"/>
</af:table>
</af:panelCollection>
=====================
but when run the page there is no display for the row number, instead on the bottom of the table, there is only a blank row with "|" inside.
How to use the Columns Hidden | Columns Frozen space in the bottom of component af:panelCollection ?
Thanks!Hi, Arun
It works.
As in my use case, can draw an af:toolbar component into statusbar of Panel Collection facets in Structure view.
There is still a small issue:
cannot see the Columns Hidden|Columns Frozen component in the Structure view,
and if drop more than one af:toolbar into statusbar, the sencond one will fall/wrap into second row, even though there is enough space on the first row (to occupy a second row in statusbar will be a waste of space), and cannot see how to adjust.
Thank you very much!
bao -
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
Maybe you are looking for
-
HT1430 Sleep/Wake button not working
THe last few days my Sleep/Wake button has stopped working. Ive reset it but its still not working, any ideas?
-
How to use Structure In TableView
Helo BSP Gurus, In BAPI_PO_GETDETAIL, upon giving the PO number it outputs the Header and Item Data. Item data is a Table so I can display n BSP using tableview. But header falls under import parameter and being a Structure, How shld I display n BSP
-
While running the Actual Activity Price calculation through KSII, I am not getting the values. Everyhting is coming Zero. What are the settings I should Look for. Is it related to Cost component split.? Regards Kamlesh
-
After i used system restore, firefox wont open
Tonight i had to use system restore and restored my computer to early this morning. Everything else works, i can connect to the internet if i use IE, but when i goto click on Firefox Icon it won' do anything now.
-
I'm fairly new to Apple. On my imac I have about $100 in apps from the Apple App store plus a program I purchased elsewhere. Should I expect all sorts of problems with these when I upgrade to Lion or are the third parties who produced the programs/