How to know column name (not an expression) used by function-based index?
Hi guys,
Is there any way to know exact column name used by FBI? If I correct, there is SYS.ICOLDEP$ table that has mapping between index/table columns, but I don't see how it could be uniquely joined with the rest. I know about USER_IND_EXPRESSIONS, but the task is to know exact column name, not it's expression.
This required by our so-called SQL preprocessing of DB schema update utility, which parses stmt (INSERT in our case) and should check against PK/UNIQUE key values.
Thanks!
I don't think this is possible in 10g or 11g because :
1. dictionary keeps track of column number in index and not in table
2. the expression used in CREATE INDEX is a system generated column
You would have to parse the expression from USER_IND_EXPRESSIONS:
SQL> create table t(x int, y int);
Table created.
SQL> create index fbi on t(y+1);
Index created.
SQL> column index_name format a10
SQL> column column_name format a20
SQL> column column_expression format a10
SQL> select i.index_name, ic.column_name, ic.column_position as iccn, ie.column_position as iecn, ie.column_expression
2 from user_indexes i , user_ind_columns ic, user_ind_expressions ie
3 where i.index_name = ic.index_name
4 and i.index_name = ie.index_name
5 and i.index_name = 'FBI';
INDEX_NAME COLUMN_NAME ICCN IECN COLUMN_EXP
FBI SYS_NC00003$ 1 1 "Y"+1
Similar Messages
-
Why Segment shrink is not supported for tables with function-based indexes
As we all know , Segment shrink is not supported for tables with function-based indexes.
But i'm very confused .
Why Segment shrink is not supported for tables with function-based indexes ?? what's its essential?Creating a function based index creates a hidden virtual column (you'll see it if you query user_tab_cols) and once you index a virtual column you can no longer shrink the table:orcl> create table t1(c1 number,c2 as (c1 * 2)) segment creation immediate;
Table created.
orcl> alter table t1 enable row movement;
Table altered.
orcl>
orcl> alter table t1 shrink space;
Table altered.
orcl> create index i2 on t1(c2);
Index created.
orcl> alter table t1 shrink space;
alter table t1 shrink space
ERROR at line 1:
ORA-10631: SHRINK clause should not be specified for this object
orcl>so the issue is not with function based indexes per se, it is a level beneath that. Perhaps because the virtual column has no physical existance, when the row is moved there is no reason for Oracle to realize that an index needs updating? I haven't attempted to reverse engineer this, I would be interested to know if anyone else has. -
Invalid column name in query string - using Format function
In my post just before this one the problem was solved for writing a query string using a date range. The rest of the query string includes the same date field (Call_Date) but formatted as 'MMM-YY'. I get an invalid column name error when I add this field to the query string. Here is the rest of the query string:
strSql = "SELECT Format(CALL_DATE,'mmm-yy'), " _
& "HOME_REGION FROM CCC2.CASE_EPRP " _
& "WHERE (HOME_REGION = 'NCR') AND " _
"(CALL_DATE >= to_date( '1/1/2002', 'MM/DD/YYYY' )" _
& "AND CALL_DATE <= to_date( '2/28/2003', 'MM/DD/YYYY' ))"
In the Access Query tool I can include this field
Format(CALL_DATE,'mmm-yy')
and the query runs fine (I just need to make it dynamic using ADO). But in my ADO query string above, I get the invalid column name error. Is there a way I can include
Format(CALL_DATE,'mmm-yy')
in my ADO query string? I appologize for not being more familiar with Oracle Sql. Any help greatly appreciated.
Thanks again,
RichThank you very much for your reply. I think I'm getting closer to the solution. Just I got an error message
"date format not recognized"
when I add "to_char( call_date, 'mmm-yy' )" to the query string. I tried using all uppercase, but that did not make a difference. Do I need to use to_date inside the to_char maybe?
to_char(to_date(call_date, 'mmm/yy'), 'mmm-yy')
Thanks again for your help.
Rich -
Function Based Index on Date Column
Hi All,
I need to execute a query like this :
SELECT * FROM ORDERS WHERE APPROVE_DATE IS NULL
I read anywhere that this will cause unnecessary FTS so that I should create function based index.
I have tried one below , but not sure that this is correct approach :
CREATE INDEX idx_1
ON ORDERS (NVL(APPROVE_DATE, '01-JAN-1900'));
SELECT * FROM ORDERS WHERE NVL(APPROVE_DATE, '01-JAN-1900') = '01-JAN-1900'
Is this a correct approach ?
Thank you,
xtantoA SQL_TRACE output will explain clearly what Justin has stated.
I have created a table T based on all_objects.
SQL> desc t
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NOT NULL NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME NOT NULL DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
CASE I_
SQL> select count(1) from t
2 /
COUNT(1)
934320
SQL> select count(1) from t where created is null
2 /
COUNT(1)
2376The number of null values in CREATED column is proportionately very small.
Now i execute the query without function based index.
select *
from t
where created is null
call count cpu elapsed disk query current rows
Parse 1 0.00 0.09 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 160 0.04 0.10 0 12662 0 2376
total 162 0.04 0.19 0 12662 0 2376
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
2376 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)And here is the query that uses the function based index
select *
from t
where nvl(created,to_date('01-01-1900','DD-MM-YYYY')) = to_date('01-01-1900','DD-MM-YYYY')
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 160 0.01 0.01 0 698 0 2376
total 162 0.03 0.01 0 698 0 2376
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
2376 TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF 'T' (TABLE)
2376 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'T_FN_IDX' (INDEX)Its very obvious from the above output that the Function Based Index as increased the performance.
CASE II_
SQL> select count(1) from t
2 /
COUNT(1)
934320
SQL> select count(1) from t where created is null
2 /
COUNT(1)
202168Now the null values in the CREATED column is proportionately large than the first test case.
Now lets see without using the function based index
select *
from t
where created is null
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 13479 0.46 0.71 2 25832 0 202168
total 13481 0.46 0.71 2 25832 0 202168
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
202168 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)Now iam trying to use the function based index
select *
from t
where nvl(created,to_date('01-01-1900','DD-MM-YYYY')) = to_date('01-01-1900','DD-MM-YYYY')
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 13479 0.54 0.84 0 33826 0 202168
total 13481 0.54 0.84 0 33826 0 202168
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
202168 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)Its obvious from the result that oracle has decided to go for a FULL TABLE SCAN even when an index was available.
So just having a function based index is not going to increase the query performance. There are lot of other factors to be considered as stated above.
Thanks,
Karthick. -
How to know columns and table name whose column size are modified
Hi guys
I want to know which all columns in the tables are modify
i.e. list of columns and table name whose column size are modified
Step1 :
CREATE TABLE employees
( employee_number number(5) ,
employee_name varchar2(50) ,
department_id number(10)
CREATE TABLE Supplier
( Supplier_number number(5) ,
Supplier_name varchar2(50) ,
CREATE TABLE customers
( customer_id number(10) not null,
customer_name varchar2(50),
address varchar2(50),
city varchar2(50),
state varchar2(25),
zip_code varchar2(10),
Step2 :
Alter table employees
MODIFY employee_number number(10)
ALTER TABLE supplier
MODIFY supplier_name varchar2(100)
step3
query to dispaly
columnname table name
employee_number employees
supplier_name supplier
How to know columns and table name whose column size are modified
could you please provide query
Thanks in Advance09:35:50 SQL> desc dba_objects
Name Null? Type
OWNER VARCHAR2(30)
OBJECT_NAME VARCHAR2(128)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
NAMESPACE NUMBER
EDITION_NAME VARCHAR2(30)LAST_DDL_TIME can be utilized -
How to pass column name at run time in function.
how to pass column name at run time in function as parameter.
thank in advance
pramod patelHello,
Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
p_value_number in number)
return number is
v_stmt varchar2(500);
begin
v_stmt := 'update emp
set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
where empno = 7369';
execute immediate v_stmt;
return 0;
commit;
end;
call to this function can be like this..
declare
v_number number;
begin
v_number := fun_updtest('SAL',5000);
end;
Adinath Kamode -
Error in COLMAP clause. Column name not found
Hi guys,
I must be missing something extremely simple here but I can't figure it out. I have a very simple test I am trying to perform. Remap a column from 1 table into another on replicat.
I have created the defgens file.
* Definitions created/modified 2013-02-12 13:08
* Field descriptions for each column entry:
* 1 Name
* 2 Data Type
* 3 External Length
* 4 Fetch Offset
* 5 Scale
* 6 Level
* 7 Null
* 8 Bump if Odd
* 9 Internal Length
* 10 Binary Length
* 11 Table Length
* 12 Most Significant DT
* 13 Least Significant DT
* 14 High Precision
* 15 Low Precision
* 16 Elementary Item
* 17 Occurs
* 18 Key Column
* 19 Sub Data Type
Definition for table BILLING.B1
Record length: 92
Syskey: 0
Columns: 2
B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
B_F_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 0 0
End of definition
Definition for table BILLING.B2
Record length: 92
Syskey: 0
Columns: 2
B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
B_L_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 1 0
End of definition
I have setup the replicat to read the sourcedefs and remap the column
-- Identify the Replicat group:
REPLICAT rxtest
-- State that source and target definitions are identical:
--ASSUMETARGETDEFS
SOURCEDEFS /u12/oracle/golden_gate_11_rep/dirsql/defgen_billing.sql
--Discard Setup
DISCARDFILE /u12/oracle/golden_gate_11_rep/dirout/rxtest.txt , PURGE
SETENV (NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252")
-- Specify database login information as needed for the database:
USERID gg, PASSWORD
-- Specify error handling rules:
REPERROR (DEFAULT, ABEND)
DDL EXCLUDE ALL
MAP billing.b1, TARGET billing.r1,
COLMAP (
B_ID = id,
b_f_name = f_name);
Now when I try and start the rxtest replicat I get this error in the report.
MAP resolved (entry BILLING.B1):
MAP BILLING.B1, TARGET billing.r1, COLMAP ( B_ID = id, b_f_name = f_name);
...( B_ID = id, b_f_name = f_name...
^
Error in COLMAP clause. Column name not found.
Any ideas? Thanksdesc billing.r1 - does that table have columns that you've included in the map clause?
But, check the ordering of the columns in colmap - it goes target_column_name = source_column_name, looks like you have that reversed.
I don't know why people insist on using SQL file extensions on def files, and placing them in the dirsql directory. What was wrong with using the (already created for you) dirdef directory? And naming the file with an extension like def or defs? It is not a SQL file. -
How to get column names for a specific view in the scheme?
how to get column names for a specific view in the scheme?
TIA
Don't have DD on the wall anymore....or this?
SQL> select text from ALL_VIEWS
2 where VIEW_NAME
3 ='EMP_VIEW';
TEXT
SELECT empno,ename FROM EMP
WHERE empno=10 -
How to pass column name as a values from one page to another
hi
i have created a report(pivot) from a table
SQL> SELECT * FROM T;
C1 C2 C3 D SEQ
A AA 2 1
A AB 3 2
A AC 2 3
B AB 5 4
B AC 6 5
SQL> SELECT C1
2 ,NVL(MAX(CASE WHEN C2='AA' THEN C3 END),'') AA
3 ,NVL(MAX(CASE WHEN C2='AB' THEN C3 END),'') AB
4 ,NVL(MAX(CASE WHEN C2='AC' THEN C3 END),'') AC
5 ,SUM(C3) FROM T GROUP BY C1;
C1 AA AB AC SUM(C3)
A 2 3 2 7
B 5 6 11
SQL>
my requirement in Apex is like this(reverse)
eg-
when i click on cell values '2' then,it should return
C1 C2 C3 D SEQ
A AA 2 1
{quote}how to pass column name as a values from one page to another
for example i have to pass 'c2' as a value to next page{quote}for report pivot you can reffer below link
Report
Amuthanks for your reply
i 'm doing what exactly you mention here .
my problem here is
i have 15 columns
i am executing a query based on the values of the column(column name) in the target page
1)here i am passing(all) the column values to the next page-but i want to pass only one column values(column name)
when i click on any cell of that column
OR
2)i can pass all column name to target page -there(in the target page) i can filter out
i think option 1 would good if you filter out the unwanted columns
Regards
Amul -
How to get column names in table maintenance dialog?
I created a new Z table and created a maintanance dialog so that I can maintain the table through sm30. i don't see columns names on maintenance screen, just a "+" sign for each column! Could someone please tell me how to display column name?
Thanks.
MithunHello Mithun
The column texts are taken from the field descriptions of the data elements used in your z-table. A "+" sign usually indicates that none of the field descriptions of the data element has been maintained.
Regards
Uwe -
How to rename column name of table?
Hello...
How to rename column name of table?
The column have data.
Thanks.
Martonio.The following should work in 9i release 2 and above.
SQL> create table mytable(col1 varchar2(2),
2 col2 date);
Table created.
SQL> insert into mytable values('t1',sysdate);
1 row created.
SQL> select * from mytable;
CO COL2
t1 30-NOV-04
1 row selected.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
COL2 DATE
SQL> alter table mytable rename column col2 to mydate;
Table altered.
SQL> desc mytable
Name Null? Type
COL1 VARCHAR2(2)
MYDATE DATE
SQL> select * from mytable;
CO MYDATE
t1 30-NOV-04
1 row selected.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.3.0 - Productionhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/wnsql.htm#972698 -
Strange error "Invalid column name 'not applicable'
When I am trying this piece of code on Solaris 10 having sybase ASE 12.5 installed :
ResultSet rs = stmt.executeQuery("sp_helpdb master");
while(rs.next()){
System.out.println(rs.getString(1));
I am getting the following error:
Invalid column name 'not applicable'
This query returns multiple result sets.
I am able to print all values in the first result set only.
Its failing in rs.next();
I am using jConnect 5.2 driver.
The same query is executing fine on Solaris 8 having ASE 12.0 installed.
If i use :
ResultSet rs = stmt.executeQuery("sp_helpdb master");
then there is no problem in Solaris 10
Plz help me.
Its urgentYou need to use execute() not executeQuery() in the scenario below and use the multi-result set logic
If you are using jConnect, see the samples for an example. -
How to know whether the current database is using a password file or not?
How to know whether the current database is using a password file or not?
The remote_password_file is the parameter that determines if you can use or not a password file. The values this parameter can have are NONE, SHARED, EXCLUSIVE. It is pretty obvious, if it is set to either SHARED or EXCLUSIVE the oracle instance has enabled the access through a password file for the SYSDBA and SYSOPER roles.
~ Madrid -
Function based indexes info,pls let me know data dictionary table name?
Hi,
pls let me know,Where can we find Function based index information ,that is data dictionary table name,.
that is information like function used, column name.
Thanks,
KUmar.all_ind_expressions
-
How to know which type of jdbc driver used in my application
How to know which type of jdbc driver used in my application.
My approach will be....
Type1: you have to have ODBC s/w install on your machine...even the connection string starts with jdbc:odbc....so it can be identifed easily
Type2: you have to install client s/w in your machine...if you are using oracle oci driver ...you need to install oracle client s/w
Type3: you use servername / port to connnect to middleware
Type4: you do not need any client s/w
So, If your application works without any client s/w on your machine....you might be using Type4/Type3 driver.....otherwise Type2
Someone pls add more ....
Maybe you are looking for
-
Problem in Sales order - Dmp file is created
Hello, I have created User defined Tab and i put matrix in User defined Tab in Sales Order Form. I fill matrix successfully from my tables. But problem is occuer when i clicked in checkbox in Matrix. The Problem is as below. C:\Documents and Setting
-
Printing Problems with PowerPoint 2007
Running Acrobat Pro 8.1.4, / Distiller Pro 8.1.3 / and PDF Maker Plug-in 8.1.3.0 / Windows XP. Using the plug-in from PowerPoint 2007 to create a PDF file of that PowerPoint, I see the following: "preparing slide" and then "Converting to Adobe PDF .
-
Hi, I am working on JSF1.2 in SAP NetWeaver CE and I am using Tiles. Please help me to resolve the following issues. ~~~~~~~~~~~~~~~~~~~ 1. File:G:\ws_wd\ce_ws.jdi\LocalDevelopment\DCs\demo.sap.com\lbsjsf\ear\_comp\gen\default\deploy\demo.sap.com~lbs
-
Help: Only 2-channel stereo audio!
I only get Stero audio off my Apple TV. I have it connected via HDMI to my Pioneer Elite receiver which is HDMI to my Plasma TV set. I have updated it to the latest software but cannot get the receiver to switch to Dolby for movies or anything. My
-
I know rest buttons are useless, but my customer wants one, so here I am. I have a form, and the text input and radio buttons have cfif statement to check for values. It all works well. But, by putting cfif in the input fields, the Reset button will