Virtual column based partitioning
Hi,
we have a non-partitioned table in a production database and wish to partition it based on an expression. Since we are on 11.2 the first thing that comes to mind is virtual column based partitioning. The "problem" is that in order to partition by a virtual column, you have to create one, and adding a new column to a table could break any application that doesn't reference the existing columns by name, e.g. "SELECT *" or. "INSERT INTO table VALUES(....)".
My question is: is it possible to somehow specify the expression on which to partition directly in the "partition by" clause rather than specifying it as a virtual column definition?
Example:
Instead of this..
SQL> create table test (
2 id number not null,
3 content varchar2(10),
4 record_type varchar2(1) generated always as (case when (substr(content, 1, 1)='B' and not substr(content, 1, 3)='Bxy') then 'B' else 'A' end) virtual
5 )
6 partition by list(record_type)
7 (
8 partition partA values ('A'),
9 partition partB values ('B')
10 );
Table created...I'd like to use something like this:
SQL> create table test (
2 id number not null,
3 content varchar2(10)
4 )
5 partition by list((case when (substr(content, 1, 1)='B' and not substr(content, 1, 3)='Bxy') then 'B' else 'A' end))
6 (
7 partition partA values ('A'),
8 partition partB values ('B')
9 );
partition by list((case when (substr(content, 1, 1)='B' and not substr(content, 1, 3)='Bxy') then 'B' else 'A' end))
ERROR at line 5:
ORA-00904: : invalid identifierThank you in advance for any answers.
Regards,
Jure
adding a new column to a table could break any application that doesn't reference the existing columns by name, e.g. "SELECT *" or. "INSERT INTO table VALUES(....)". "Ok, i got it. You mean, in application you are using select * from yourtable; and those data is being used by a datagrid or any control, then where that application will show / handle the new column data right ?
Yes, thats why DBA and developers do SDLC (Software Development Life Cycle); that our table will be looks like this, these will be columns, these will be their data types, these will be followed in naming convention, privileges, indexes, storage parameters, constraints, dependent objects etc. Now after creating the table, you found a need to add a column, it means there was some lapses happened at the design time/phase or business requirements are newly defined.
So, as far as concerned of select * ... ; you have to change in the application by :
select col1, col2, new_col from your table... (as per order of your datagrid control columns). There is no other solution, you have to change in application code at every place where you have used select * and if those statements are being merged / deals into a control)
New column addition will hamper only at select * from... not with any INSERT/UPDATE/DELETE, because if they are running fine it means, they have well written column references. For DMLs you need not worry so far.
By the way, what is your technology for application ? I have worked on couple of applications in ASP.NET with using datagrid which auto add/removes the columns in itself as per cursor result (not rememberring the exact property of it though)
Regards
Girish Sharma
Similar Messages
-
Range partitioning on virtual column based on binary xmltype column
Alright, our DBA finally got around to upgrading to 11.2.0.2. Now I'm running into another issue:
CREATE TABLE USER.DI_D2
ID NUMBER(19, 0) NOT NULL ,
XML SYS.XMLTYPE ,
PRIMARY KEY ( ID )
XMLTYPE XML STORE AS SECUREFILE BINARY XML
VIRTUAL COLUMNS
ts AS (TO_TIMESTAMP(extractvalue(xml,'/d:d/c:dHeader/c:creationTime',
'xmlns:d="http://www.example.com/m/d/schema/di"
xmlns:c="http://www.example.com/m/schema/common"'),'YYYY-MM-DD"T"HH24:MI:SS'))
PARTITION BY RANGE (ts)
PARTITION d_p2012_07 VALUES LESS THAN (TO_DATE('1-8-2012','DD-MM-YYYY')),
PARTITION d_px VALUES LESS THAN (MAXVALUE)
);On our old 11.2.0.1 install this command works fine (tho due to other issues 11.2.0.1 doesn't work for our search queries)
On our 11.2.0.2 install, I get the following error:
Error at Command Line:10 Column:37
Error report:
SQL Error: ORA-14513: Partitiekolom mag niet van het gegevenstype object zijn.
14513. 00000 - "partitioning column may not be of object datatype"
*Cause: Partitioning column specified by the user was an object datatype
(object, REF, nested table, array) which is illegal.
*Action: Ensure that no partitioning column is an object datatype.Anyone know what's up with that? What changed between the 2 DB versions that could cause this to fail?Alright, seems that's just a display issue then.
Looking in user_lobs like suggested above gives
TABLE_NAME COLUMN_NAME SECUREFILE
DI_D XMLDATA YES I was opening the table in SQL Developer and then looking in the tab SQL (12th tab); with a XmlType table it seems to always show Basicfile even if it's actually a Securefile.
I'd like to use the suggested xmlcast/xmlquery solution, however it doesn't seem to play well with our custom timestamp format.
"CREATION_TIME" AS (XMLCAST(XMLQUERY('declare default element namespace "http://www.example.com/m/d/schema/i";declare namespace c="http://www.example.com/m/schema/common";/d/c:dHeader/c:creationTime' PASSING OBJECT_VALUE RETURNING CONTENT) AS TIMESTAMP))
Error at Command Line:1 Column:0
Error report:
SQL Error: ORA-54002: In de uitdrukking van een virtuele kolom kunnen alleen zuivere functies worden opgegeven.
"CREATION_TIME" AS (TO_TIMESTAMP(XMLQUERY('declare default element namespace "http://www.example.com/m/d/schema/i";declare namespace c="http://www.example.com/m/schema/common";/d/c:dHeader/c:creationTime' PASSING OBJECT_VALUE RETURNING CONTENT),'YYYY-MM-DD"T"HH24:MI:SS'))
Error at Command Line:9 Column:45
Error report:
SQL Error: ORA-00932: inconsistente gegevenstypen: - verwacht, - gekregen
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
"CREATION_TIME" AS (TO_TIMESTAMP(EXTRACTVALUE("OBJECT_VALUE",'/di:d/c:dHeader/c:creationTime','xmlns:di="http://www.example.com/m/d/schema/i" xmlns:c="http://www.example.com/m/schema/common"'),'YYYY-MM-DD"T"HH24:MI:SS'))
table "USER"."DI_D" created. -
Virtual column and partition exchange load
Hi All,
Can someone tell me that if i have a virtual column on a table in 11g then can we load the data as partition exchange loading into the table.
Thanks & Regards,
Ankit RanaHemant K Chitale wrote:
Why not run a simple test with a dummy table, a few columns (plus a virtual column) and a few partitions ?
Excellent suggestion.
Shouldn't take more than about 30 minutes to create a test case - and if it takes more than 30 minutes the OP needs the practice anyway to get a better feel for the technology.
Hint to OP: make sure you put some data in the "incoming" table, make sure you put some data in the "non-exchanged" partitions, remember to include a unique/pk constraint if you're expecting one on production, and run with sql_trace enabled to see what's happening in the background.
Regards
Jonathan Lewis -
ORA-00904 on CREATE TABLE with virtual column based on XMLTYPE content
Hello,
this is another one for the syntax gurus...
Trying the following, fails with ORA-00904: "MESSAGE"."GETROOTELEMENT": invalid identifier
CREATE TABLE XML_TEST_VIRT
MSG_TYPE GENERATED ALWAYS AS (MESSAGE.GETROOTELEMENT()) VIRTUAL,
MESSAGE XMLTYPE NOT NULL,
IE906 XMLTYPE DEFAULT NULL
XMLTYPE COLUMN MESSAGE STORE AS SECUREFILE BINARY XML
XMLTYPE COLUMN IE906 STORE AS SECUREFILE BINARY XML
/while this one succeeds
CREATE TABLE XML_TEST_VIRT
MSG_TYPE GENERATED ALWAYS AS (EXTRACT(MESSAGE, '/*').GETROOTELEMENT()) VIRTUAL,
MESSAGE XMLTYPE NOT NULL,
IE906 XMLTYPE DEFAULT NULL
XMLTYPE COLUMN MESSAGE STORE AS SECUREFILE BINARY XML
XMLTYPE COLUMN IE906 STORE AS SECUREFILE BINARY XML
/The GETROOTELEMENT member function of SYS.XMLTYPE is declared as "DETERMINISTIC PARALLEL_ENABLE" so the method getting called is not the problem as the 2nd case proves.
Using the column MESSAGE which is of type XMLTYPE directly seems to be the problem. But the question is "why". The EXTRACT function result is of type XMLTYPE and calling its member works, the column is also of type XMLTYPE yet calling its member fails...
Thanks in advance for any insights on this.
Best Regards
PhilipHmmmm ... I don't know if I should smile or frown with the implication that I am an OO guy :D :D
Most of my colleagues when I started working as a software engineer, treated me as too low-level because of my C background (started doing C in 1985).
In my last job, my colleagues hated my guts because I was asking them to squeeze every bit of performance out of C++ by using STL which is definitely not OO (although C++ is).
My current colleagues treat me as a DB guru (which I most definitely am not) and they overlook/forget the fact that most of them use Java libraries in their projects, that I wrote for them !
I am inclined to believe that I do not fall into any category in the end...
The only thing I am for sure - and I am proud of it - is inquisitive. I want to know everything there is about the tools I use, and so I end up spending hours and hours investigating... (Microsoft found that out the hard way when I filed 16 bug reports in 8 days when Visual C++ 6 came out ! Not that it hurt them though...)
This is where my confession ends (and my working on the XML validator starts...)
Καληνύχτα Marco
Philip (Φίλιππος in Greek)
PS: I did not follow the last solution anyway. I just wanted to verify its operability ;) -
Partition by virtual column, select - sinlgle partition on two columns
Pls, I have a question - we have table with COLUMNs:
-- TIME_KEY - julian - date value (to_char(sysdate, 'J')) - we would like to have virtual date value:
-- TIME_ID - virtual column with interval partitioning (great!)
CREATE TABLE lsd_cntr_pokus
( time_key NUMBER not NULL
, time_ID AS (to_date(time_key,'J'))
, cntr_key NUMBER not NULL
---...etc
PARTITION BY RANGE (time_ID) INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
(PARTITION part_2007 VALUES LESS THAN
(TO_DATE('01-JAN-2007','dd-MON-yyyy'))
But then - is it possible to somehow define this table,
so both selects:
SELECT * FROM lsd_cntr_pokus
WHERE time_key = to_char(TO_DATE('01.01.2007', 'DD.MM.YYYY'),'j') ;
SELECT * FROM lsd_cntr_pokus
WHERE time_id = TO_DATE('01.01.2007', 'DD.MM.YYYY') ;
use PARTITION RANGE SINGLE?
Thanks for any help,
Regards
Edited by: vrbcik on Dec 10, 2012 3:39 PMvrbcik wrote:
Pls, I have a question - we have table with COLUMNs:
-- TIME_KEY - julian - date value (to_char(sysdate, 'J')) - we would like to have virtual date value:
-- TIME_ID - virtual column with interval partitioning (great!)
CREATE TABLE lsd_cntr_pokus
( time_key NUMBER not NULL
, time_ID AS (to_date(time_key,'J'))
, cntr_key NUMBER not NULL
---...etc
PARTITION BY RANGE (time_ID) INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
(PARTITION part_2007 VALUES LESS THAN
(TO_DATE('01-JAN-2007','dd-MON-yyyy'))
But then - is it possible to somehow define this table,
so both selects:
SELECT * FROM lsd_cntr_pokus
WHERE time_key = to_char(TO_DATE('01.01.2007', 'DD.MM.YYYY'),'j') ;
SELECT * FROM lsd_cntr_pokus
WHERE time_id = TO_DATE('01.01.2007', 'DD.MM.YYYY') ;
use PARTITION RANGE SINGLE?
Thanks for any help,
Regards
Edited by: vrbcik on Dec 10, 2012 3:39 PMHi,
I'm afraid that, with this partition definition, partition pruning is working only when you use your virtual column time_id in your query.
According to documentation Information That Can Be Used for Partition Pruning:
Virtual column-based partitioned tables benefit from partition pruning for statements that use the virtual column-defining expression in the SQL statement.Maybe some tuning expert can confirm this or give another advice.
Regards.
Al -
Re: Virtual Columns and Import/Export
Edited by the moderator:
This question was moved to a new thread since the last thread was over 1 year old. The basic question is:
table has virtual columns based on a schema function but tables are created before the function. Is there a solution for this:
end edit:
I've encountered the same issue. Does anyone know there is a solution to this yet?
Thanks,
Dave
Edited by: Dean Gagne on Sep 12, 2012 4:02 PMI branched to a new thread since that thread was over a year old.
Anyway, I would contact Oracle Support to see if there is a fix for this for the version of Oracle that you are using. This has been fixed and backported, but I don't know if that it was backported to your version or not.
The real problem is that the virtual column needed to be created when the table was created, but the function was not imported yet. As a work-around you could create the schema and then just import the functions first. Not ideal, but it may get you past this issue for now.
The right way is to get a patch.
Dean -
Virtual column partitioning - explain plan takes lot of time.
I have some problem with table with partitioning based on virtual column.
Explain plan generates for some simple select 2-5 minutes,
but the same select but without part of where clausule generate in secounds.
In both query there is the same explain plan.
Could someone explain why?
Table:
CREATE TABLE "SUBSCRIPTION"
"CUSTOMER_ID" VARCHAR2(100 BYTE),
"IDENT_SOURCE_ID" VARCHAR2(20 BYTE),
"ACCOUNT_ID" VARCHAR2(100 BYTE),
"MSISDN" VARCHAR2(500 BYTE),
"IMSI" VARCHAR2(500 BYTE),
"SIM" VARCHAR2(500 BYTE),
"IMEI" VARCHAR2(500 BYTE),
"MEID" VARCHAR2(15 BYTE),
"EMAIL" VARCHAR2(100 BYTE),
"TELCOOP" VARCHAR2(1000 BYTE),
"MSISDN_TYPE" VARCHAR2(20 BYTE),
"GSM" NUMBER(1,0),
"CDMA" NUMBER(1,0),
"VALID_FROM" DATE,
"VALID_TO" DATE,
"MSISDN_HASH" NUMBER(3,0) GENERATED ALWAYS AS (MOD(TO_NUMBER(NVL2(RTRIM(TRANSLATE(NVL(SUBSTR("MSISDN",-3),NVL("MSISDN",'err')),'123456789','000000000'),'0'),'-1',NVL(SUBSTR("MSISDN",-3),"MSISDN"))),125)) VIRTUAL VISIBLE, --generali mod from 3 last digits of msisdn
) PARTITION BY LIST ( "MSISDN_HASH" )
PARTITION "PCHR" VALUES ( -1 )
PARTITION "P000" VALUES ( 0 )
PARTITION "P001" VALUES ( 1 )
... and so on till...
PARTITION "P124" VALUES (124)
PARALLEL 4;
Slow select:
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from dbident2.subscription
where MSISDN = '600489461'
AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
Fast select:
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from dbident2.subscription
where MSISDN = '600489461'
AND MSISDN_HASH = 86--Slower select trace:
Registered qb: SEL$1 0xf4ea2a20 (PARSER)
QUERY BLOCK SIGNATURE
signature (): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=4 objn=848731 hint_alias="SUBSCRIPTION"@"SEL$1"
SPM: statement not found in SMB
SPM: statement not a candidate for auto-capture
Dynamic sampling level auto-adjusted from 6 to 6
Automatic degree of parallelism (ADOP)
Automatic degree of parallelism is disabled: Parameter.
PM: Considering predicate move-around in query block SEL$1 (#0)
Predicate Move-Around (PM)
OPTIMIZER INFORMATION
----- Current SQL Statement for this session (sql_id=afjvvjmx6tqgr) -----
explain plan for
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from subscription
where MSISDN = '600600600' AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
Legend
The following abbreviations are used by optimizer trace.
CBQT - cost-based query transformation
JPPD - join predicate push-down
OJPPD - old-style (non-cost-based) JPPD
FPD - filter push-down
PM - predicate move-around
CVM - complex view merging
SPJ - select-project-join
SJC - set join conversion
SU - subquery unnesting
OBYE - order by elimination
OST - old style star transformation
ST - new (cbqt) star transformation
CNT - count(col) to count(*) transformation
JE - Join Elimination
JF - join factorization
SLP - select list pruning
DP - distinct placement
qb - query block
LB - leaf blocks
DK - distinct keys
LB/K - average number of leaf blocks per key
DB/K - average number of data blocks per key
CLUF - clustering factor
NDV - number of distinct values
Resp - response cost
Card - cardinality
Resc - resource cost
NL - nested loops (join)
SM - sort merge (join)
HA - hash (join)
CPUSPEED - CPU Speed
IOTFRSPEED - I/O transfer speed
IOSEEKTIM - I/O seek time
SREADTIM - average single block read time
MREADTIM - average multiblock read time
MBRC - average multiblock read count
MAXTHR - maximum I/O system throughput
SLAVETHR - average slave I/O throughput
dmeth - distribution method
1: no partitioning required
2: value partitioned
4: right is random (round-robin)
128: left is random (round-robin)
8: broadcast right and partition left
16: broadcast left and partition right
32: partition left using partitioning of right
64: partition right using partitioning of left
256: run the join in serial
0: invalid distribution method
sel - selectivity
ptn - partition
PARAMETERS USED BY THE OPTIMIZER
PARAMETERS WITH ALTERED VALUES
Compilation Environment Dump
pgamax_size = 1258280 KB
parallel_query_default_dop = 32
db_file_multiblock_read_count = 16
Bug Fix Control Environment
PARAMETERS IN OPT_PARAM HINT
Column Usage Monitoring is ON: tracking level = 1
Considering Query Transformations on query block SEL$1 (#0)
Query transformations (QT)
JF: Checking validity of join factorization for query block SEL$1 (#0)
JF: Bypassed: not a UNION or UNION-ALL query block.
ST: not valid since star transformation parameter is FALSE
TE: Checking validity of table expansion for query block SEL$1 (#0)
TE: Bypassed: No relevant table found.
CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION (ALL) queries.
CBQT: Validity checks failed for afjvvjmx6tqgr.
CSE: Considering common sub-expression elimination in query block SEL$1 (#0)
Common Subexpression elimination (CSE)
CSE: CSE not performed on query block SEL$1 (#0).
OBYE: Considering Order-by Elimination from view SEL$1 (#0)
Order-by elimination (OBYE)
OBYE: OBYE bypassed: no order by to eliminate.
CVM: Considering view merge in query block SEL$1 (#0)
query block SEL$1 (#0) unchanged
Considering Query Transformations on query block SEL$1 (#0)
Query transformations (QT)
JF: Checking validity of join factorization for query block SEL$1 (#0)
JF: Bypassed: not a UNION or UNION-ALL query block.
ST: not valid since star transformation parameter is FALSE
TE: Checking validity of table expansion for query block SEL$1 (#0)
TE: Bypassed: No relevant table found.
CBQT bypassed for query block SEL$1 (#0): no complex view, sub-queries or UNION (ALL) queries.
CBQT: Validity checks failed for afjvvjmx6tqgr.
CSE: Considering common sub-expression elimination in query block SEL$1 (#0)
Common Subexpression elimination (CSE)
CSE: CSE not performed on query block SEL$1 (#0).
SU: Considering subquery unnesting in query block SEL$1 (#0)
Subquery Unnest (SU)
SJC: Considering set-join conversion in query block SEL$1 (#0)
Set-Join Conversion (SJC)
SJC: not performed
PM: Considering predicate move-around in query block SEL$1 (#0)
Predicate Move-Around (PM)
PM: PM bypassed: Outer query contains no views.
PM: PM bypassed: Outer query contains no views.
query block SEL$1 (#0) unchanged
FPD: Considering simple filter push in query block SEL$1 (#0)
"SUBSCRIPTION"."MSISDN"='600600600' AND "SUBSCRIPTION"."MSISDN_HASH"=86 AND "SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
try to generate transitive predicate from check constraints for query block SEL$1 (#0)
finally: "SUBSCRIPTION"."MSISDN"='600600600' AND "SUBSCRIPTION"."MSISDN_HASH"=86 AND "SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
apadrv-start sqlid=12053738773107497463
call(in-use=8176, alloc=32712), compile(in-use=114912, alloc=116848), execution(in-use=175432, alloc=178928)
Peeked values of the binds in SQL statement
Final query after transformations:******* UNPARSED QUERY IS *******
SELECT "SUBSCRIPTION"."CUSTOMER_ID" "CUSTOMER_ID","SUBSCRIPTION"."IDENT_SOURCE_ID" "IDENT_SOURCE_ID","SUBSCRIPTION"."ACCOUNT_ID" "ACCOUNT_ID","SUBSCRIPTION"."MSISDN" "MSISDN","SUBSCRIPTION"."IMSI" "IMSI","SUBSCRIPTION"."SIM" "SIM","SUBSCRIPTION"."IMEI" "IMEI","SUBSCRIPTION"."MEID" "MEID","SUBSCRIPTION"."EMAIL" "EMAIL","SUBSCRIPTION"."TELCOOP" "TELCOOP" FROM "DBIDENT2"."SUBSCRIPTION" "SUBSCRIPTION" WHERE "SUBSCRIPTION"."MSISDN"='600600600' AND "SUBSCRIPTION"."MSISDN_HASH"=86 AND "SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
kkoqbc: optimizing query block SEL$1 (#0)
call(in-use=8320, alloc=32712), compile(in-use=115880, alloc=116848), execution(in-use=175432, alloc=178928)
kkoqbc-subheap (create addr=0x2b24ebece950)
QUERY BLOCK TEXT
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from subscription
where MSISDN = '600600600' AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
QUERY BLOCK SIGNATURE
signature (optimizer): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=0 objn=848731 hint_alias="SUBSCRIPTION"@"SEL$1"
SYSTEM STATISTICS INFORMATION
Using NOWORKLOAD Stats
CPUSPEEDNW: 714 millions instructions/sec (default is 100)
IOTFRSPEED: 4096 bytes per millisecond (default is 4096)
IOSEEKTIM: 10 milliseconds (default is 10)
MBRC: -1 blocks (default is 16)
BASE STATISTICAL INFORMATION
Table Stats::
Table: SUBSCRIPTION Alias: SUBSCRIPTION Partition [87]
#Rows: 218104 #Blks: 11008 AvgRowLen: 129.00 ChainCnt: 0.00
#Rows: 218104 #Blks: 11008 AvgRowLen: 129.00 ChainCnt: 0.00
Index Stats::
Index: SUBSCRIPTION_NDX_ACCID Col#: 3
LVLS: 3 #LB: 121036 #DK: 9767936 LB/K: 1.00 DB/K: 1.00 CLUF: 13921256.00
Index: SUBSCRIPTION_NDX_CUSID Col#: 1 2 18
LVLS: 3 #LB: 142123 #DK: 24665396 LB/K: 1.00 DB/K: 1.00 CLUF: 24842146.00
Index: SUBSCRIPTION_NDX_EMAIL Col#: 9
LVLS: 2 #LB: 8365 #DK: 1361827 LB/K: 1.00 DB/K: 1.00 CLUF: 1361798.00
Index: SUBSCRIPTION_NDX_EXT1 Col#: 19
LVLS: 2 #LB: 65756 #DK: 67792 LB/K: 1.00 DB/K: 80.00 CLUF: 5446485.00
Index: SUBSCRIPTION_NDX_IMEI Col#: 7
LVLS: 2 #LB: 44539 #DK: 9199616 LB/K: 1.00 DB/K: 1.00 CLUF: 10413439.00
Index: SUBSCRIPTION_NDX_IMSI Col#: 5
LVLS: 3 #LB: 92914 #DK: 12846080 LB/K: 1.00 DB/K: 1.00 CLUF: 23472821.00
Index: SUBSCRIPTION_NDX_MEID Col#: 8
LVLS: 1 #LB: 132 #DK: 12585 LB/K: 1.00 DB/K: 1.00 CLUF: 18419.00
Index: SUBSCRIPTION_NDX_MSISDN Col#: 4 PARTITION [87]
LVLS: 2 #LB: 1092 #DK: 74848 LB/K: 1.00 DB/K: 2.00 CLUF: 191920.00
LVLS: 2 #LB: 1092 #DK: 74848 LB/K: 1.00 DB/K: 2.00 CLUF: 191920.00
Index: SUBSCRIPTION_NDX_SIM Col#: 6
LVLS: 2 #LB: 88153 #DK: 13169664 LB/K: 1.00 DB/K: 1.00 CLUF: 24727298.00
Index: SUBSCRIPTION_NDX_SRCID Col#: 2 17
LVLS: 2 #LB: 81729 #DK: 4 LB/K: 20432.00 DB/K: 257314.00 CLUF: 1029257.00
Access path analysis for SUBSCRIPTION
SINGLE TABLE ACCESS PATH
Single Table Cardinality Estimation for SUBSCRIPTION[SUBSCRIPTION]
*** 2012-06-12 12:34:53.283
** Performing dynamic sampling initial checks. **
Column (#14):
NewDensity:0.000020, OldDensity:0.000366 BktCnt:254, PopBktCnt:22, PopValCnt:1, NDV:46252
Column (#14):
NewDensity:0.000163, OldDensity:0.000378 BktCnt:254, PopBktCnt:12, PopValCnt:1, NDV:5852
Column (#14): VALID_FROM( Part#: 87
AvgLen: 8 NDV: 5852 Nulls: 2 Density: 0.000163 Min: 2450364 Max: 2456082
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 244
Column (#14): VALID_FROM(
AvgLen: 8 NDV: 5852 Nulls: 2 Density: 0.000163 Min: 2450364 Max: 2456082
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 244
Column (#4):
NewDensity:0.000000, OldDensity:0.000000 BktCnt:254, PopBktCnt:0, PopValCnt:0, NDV:9730048
Column (#4):
NewDensity:0.000013, OldDensity:0.000033 BktCnt:254, PopBktCnt:0, PopValCnt:0, NDV:74848
Column (#4): MSISDN( Part#: 87
AvgLen: 10 NDV: 74848 Nulls: 0 Density: 0.000013
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 255
Column (#4): MSISDN(
AvgLen: 10 NDV: 74848 Nulls: 0 Density: 0.000013
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 255
** Dynamic sampling initial checks returning TRUE (level = 6).
*** 2012-06-12 12:34:53.284
** Generated dynamic sampling query:
query text :
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false') NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),0), NVL(SUM(C2),0) FROM (SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("SUBSCRIPTION") FULL("SUBSCRIPTION") NO_PARALLEL_INDEX("SUBSCRIPTION") */ 1 AS C1, CASE WHEN "SUBSCRIPTION"."MSISDN"='600600600' AND "SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss') THEN 1 ELSE 0 END AS C2 FROM "DBIDENT2"."SUBSCRIPTION" SAMPLE BLOCK (1.153706 , 1) SEED (1) "SUBSCRIPTION" WHERE "SUBSCRIPTION"."MSISDN"='600600600' AND "SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) SAMPLESUB
*** 2012-06-12 12:36:44.452
** Executed dynamic sampling query:
level : 6
sample pct. : 1.153706
total partitions : 1
partitions for sampling : 1
actual sample size : 342182
filtered sample card. : 0
orig. card. : 218104
block cnt. table stat. : 11008
block cnt. for sampling: 11008
max. sample block cnt. : 128
sample block cnt. : 127
min. sel. est. : 0.00001260
** Not using dynamic sampling for single table sel. or cardinality.
DS Failed for : ----- Current SQL Statement for this session (sql_id=afjvvjmx6tqgr) -----
explain plan for
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from subscription
where MSISDN = '600600600' AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
Column (#21):
NewDensity:0.002912, OldDensity:0.000000 BktCnt:14078, PopBktCnt:14078, PopValCnt:126, NDV:126
Column (#21): MSISDN_HASH( Part#: 87
AvgLen: 3 NDV: 1 Nulls: 0 Density: 0.000002 Min: 86 Max: 86
Histogram: Freq #Bkts: 1 UncompBkts: 13365 EndPtVals: 1
Column (#21): MSISDN_HASH(
AvgLen: 3 NDV: 1 Nulls: 0 Density: 0.000002 Min: 86 Max: 86
Histogram: Freq #Bkts: 1 UncompBkts: 13365 EndPtVals: 1
Column (#1):
NewDensity:0.000000, OldDensity:0.000241 BktCnt:254, PopBktCnt:31, PopValCnt:2, NDV:9768960
Column (#1):
NewDensity:0.000009, OldDensity:0.000250 BktCnt:254, PopBktCnt:36, PopValCnt:3, NDV:99208
Column (#1): CUSTOMER_ID( Part#: 87
AvgLen: 11 NDV: 99208 Nulls: 0 Density: 0.000009
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 222
Column (#1): CUSTOMER_ID(
AvgLen: 11 NDV: 99208 Nulls: 0 Density: 0.000009
Histogram: HtBal #Bkts: 254 UncompBkts: 254 EndPtVals: 222
Column (#2):
NewDensity:0.000639, OldDensity:0.000000 BktCnt:14078, PopBktCnt:14078, PopValCnt:3, NDV:3
Column (#2):
NewDensity:0.000786, OldDensity:0.000002 BktCnt:13365, PopBktCnt:13365, PopValCnt:3, NDV:3
Column (#2): IDENT_SOURCE_ID( Part#: 87
AvgLen: 5 NDV: 3 Nulls: 0 Density: 0.000786
Histogram: Freq #Bkts: 3 UncompBkts: 13365 EndPtVals: 3
Column (#2): IDENT_SOURCE_ID(
AvgLen: 5 NDV: 3 Nulls: 0 Density: 0.000786
Histogram: Freq #Bkts: 3 UncompBkts: 13365 EndPtVals: 3
ColGroup (#1, Index) SUBSCRIPTION_NDX_CUSID
Col#: 1 2 18 CorStregth: -1.00
ColGroup (#2, Index) SUBSCRIPTION_NDX_SRCID
Col#: 2 17 CorStregth: -1.00
ColGroup Usage:: PredCnt: 2 Matches Full: Partial:
***** Virtual column Adjustment ******
Column name MSISDN_HASH
cost_cpu 2300.00
cost_io 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00
***** End virtual column Adjustment ******
Table: SUBSCRIPTION Alias: SUBSCRIPTION
Card: Original: 218104.000000 Rounded: 3 Computed: 2.75 Non Adjusted: 2.75
Access Path: TableScan
Cost: 2420.71 Resp: 672.42 Degree: 0
Cost_io: 2409.00 Cost_cpu: 100334308
Resp_io: 669.17 Resp_cpu: 27870641
kkofmx: index filter:"SUBSCRIPTION"."MSISDN_HASH"=86
***** Virtual column Adjustment ******
Column name MSISDN_HASH
cost_cpu 2300.00
cost_io 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00
***** End virtual column Adjustment ******
Access Path: index (AllEqRange)
Index: SUBSCRIPTION_NDX_MSISDN
resc_io: 6.00 resc_cpu: 36840
ix_sel: 0.000013 ix_sel_with_filters: 0.000013
***** Logdef predicate Adjustment ******
Final IO cst 0.00 , CPU cst 2300.00
***** End Logdef Adjustment ******
Cost: 6.01 Resp: 6.01 Degree: 1
Best:: AccessPath: IndexRange
Index: SUBSCRIPTION_NDX_MSISDN
Cost: 6.01 Degree: 1 Resp: 6.01 Card: 2.75 Bytes: 0
OPTIMIZER STATISTICS AND COMPUTATIONS
GENERAL PLANS
Considering cardinality-based initial join order.
Permutations for Starting Table :0
Join order[1]: SUBSCRIPTION[SUBSCRIPTION]#0
Best so far: Table#: 0 cost: 6.0051 card: 2.7487 bytes: 291
****** Recost for parallel table scan *******
Access path analysis for SUBSCRIPTION
SINGLE TABLE ACCESS PATH
Single Table Cardinality Estimation for SUBSCRIPTION[SUBSCRIPTION]
*** 2012-06-12 12:36:44.454
** Performing dynamic sampling initial checks. **
** TABLE SUBSCRIPTION Alias: SUBSCRIPTION : reused cached dynamic sampling result (failure).
ColGroup Usage:: PredCnt: 2 Matches Full: Partial:
***** Virtual column Adjustment ******
Column name MSISDN_HASH
cost_cpu 2300.00
cost_io 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00
***** End virtual column Adjustment ******
Table: SUBSCRIPTION Alias: SUBSCRIPTION
Card: Original: 218104.000000 Rounded: 3 Computed: 2.75 Non Adjusted: 2.75
Access Path: TableScan
Cost: 2420.71 Resp: 672.42 Degree: 0
Cost_io: 2409.00 Cost_cpu: 100334308
Resp_io: 669.17 Resp_cpu: 27870641
Best:: AccessPath: TableScan
Cost: 672.42 Degree: 4 Resp: 672.42 Card: 2.75 Bytes: 97
Join order[1]: SUBSCRIPTION[SUBSCRIPTION]#0
Join order aborted: cost > best plan cost
(newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:2000
Number of join permutations tried: 1
Enumerating distribution method (advanced)
Trying or-Expansion on query block SEL$1 (#0)
Transfer Optimizer annotations for query block SEL$1 (#0)
id=0 frofkks[i] (index start key) predicate="SUBSCRIPTION"."MSISDN"='600600600'
id=0 frofkke[i] (index stop key) predicate="SUBSCRIPTION"."MSISDN"='600600600'
id=0 frofand predicate="SUBSCRIPTION"."VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
Final cost for query block SEL$1 (#0) - All Rows Plan:
Best join order: 1
Cost: 6.0051 Degree: 1 Card: 3.0000 Bytes: 291
Resc: 6.0051 Resc_io: 6.0000 Resc_cpu: 43740
Resp: 6.0051 Resp_io: 6.0000 Resc_cpu: 43740
kkoqbc-subheap (delete addr=0x2b24ebece950, in-use=21280, alloc=32840)
kkoqbc-end:
call(in-use=252920, alloc=343912), compile(in-use=129048, alloc=133000), execution(in-use=192248, alloc=195240)
kkoqbc: finish optimizing query block SEL$1 (#0)
apadrv-end
call(in-use=252920, alloc=343912), compile(in-use=129960, alloc=133000), execution(in-use=192248, alloc=195240)
Starting SQL statement dump
user_id=115 user_name=xxx module=SQL*Plus action=
sql_id=afjvvjmx6tqgr plan_hash_value=1672204165 problem_type=3
----- Current SQL Statement for this session (sql_id=afjvvjmx6tqgr) -----
explain plan for
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from subscription
where MSISDN = '600600600' AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
sql_text_length=266
sql=explain plan for
select CUSTOMER_ID, IDENT_SOURCE_ID, ACCOUNT_ID, MSISDN, IMSI, SIM, IMEI, MEID, EMAIL, TELCOOP
from subscription
where MSISDN = '600600600' AND MSISDN_HASH = 86
AND VALID_FROM <=TO_DATE('2012-02-10 00:00:00', 'YYYY-MM-DD HH2
sql=4:MI:SS')
----- Explain Plan Dump -----
----- Plan Table -----
============
Plan Table
============
-----------------------------------------------------------------------------------------------------------------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------------------------------+
| 0 | SELECT STATEMENT | | | | 6 | | | |
| 1 | PARTITION LIST SINGLE | | 3 | 291 | 6 | 00:00:01 | 88 | 88 |
| 2 | TABLE ACCESS BY LOCAL INDEX ROWID | SUBSCRIPTION | 3 | 291 | 6 | 00:00:01 | 88 | 88 |
| 3 | INDEX RANGE SCAN | SUBSCRIPTION_NDX_MSISDN| 3 | | 3 | 00:00:01 | 88 | 88 |
-----------------------------------------------------------------------------------------------------------------------+
Predicate Information:
2 - filter("VALID_FROM"<=TO_DATE(' 2012-02-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
3 - access("MSISDN"='600600600')
Content of other_xml column
===========================
nodeid/pflags: 1 1 db_version : 11.2.0.2
parse_schema : xxx
plan_hash : 1672204165
plan_hash_2 : 1960934971
Outline Data:
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
DB_VERSION('11.2.0.2')
OPT_PARAM('optimizer_dynamic_sampling' 6)
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
INDEX_RS_ASC(@"SEL$1" "SUBSCRIPTION"@"SEL$1" ("SUBSCRIPTION"."MSISDN"))
END_OUTLINE_DATA
Query Block Registry:
SEL$1 0xf4ea2a20 (PARSER) [FINAL]
call(in-use=259392, alloc=343912), compile(in-use=170344, alloc=270888), execution(in-use=344120, alloc=346656)
End of Optimizer State Dump
Dumping Hints
=============
====================== END SQL Statement Dump ======================
Edited by: user3754081 on 2012-06-12 08:07 -
Range partition by a virtual column derived from XMLTYPE
I want to create table and partition it by interval partion (range partition) on a virtual column which is derived from XMLTYPE i get ora-14513 error.
create table dicom_archive_virtual
id integer not null primary key,
parent_id integer, -- where this image is created from
dcm_filename varchar2(60), -- DICOM image file name from import
description varchar2(100), -- description of the image
dicom orddicom, -- DICOM data
image ordimage, -- DICOM data in JPEG format
thumb ordimage, -- DICOM data in JPEG thumbnail
metadata xmltype, -- user customized metadata
isAnonymous integer, -- accessible flag for the research role.
study_date date as
(to_date(substr(extractValue(metadata,'//DATE/text()'),1,10),'yyyy-mm-dd')) virtual)
PARTITION BY RANGE (study_date)
INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
( PARTITION p_2005 VALUES LESS THAN (TO_DATE('1-1-2006', 'DD-MM-YYYY')),
PARTITION p_2006 VALUES LESS THAN (TO_DATE('1-1-2007', 'DD-MM-YYYY')),
PARTITION p_2007 VALUES LESS THAN (TO_DATE('1-1-2008', 'DD-MM-YYYY'))
Study_date is a virtual colum which is derived from the column metadata which is of type XMLTYPE,so when i partition on this virtual column i get the follwoing error
SQL Error: ORA-14513: partitioning column may not be of object datatype
So i want to know whether this is not possible or there is any other alternative to achieve this.I want to create table and partition it by interval partion (range partition) on a virtual column which is derived from XMLTYPE Congratulations on trying to fit as many cutting edge techniques into a single line as possible.
So i want to know whether this is not possible ...The error message is pretty unequivocal.
...or there is any other alternative to achieve this.What you could try is materializing the virtual column, i.e. adding an actual date column which you populate with that code in the insert and update triggers. Inelegant but then complexity often is.
Cheers, APC
blog : http://radiofreetooting.blogspot.com -
Adding virtual column: ORA-12899: value too large for column
I'm using Oracle 11g, Win7 OS, SQL Developer
I'm trying to add virtual column to my test table, but getting ORA-12899: value too large for column error. Below are the details.
Can someone help me in this?
CREATE TABLE test_reg_exp
(col1 VARCHAR2(100));
INSERT INTO test_reg_exp (col1) VALUES ('ABCD_EFGH');
INSERT INTO test_reg_exp (col1) VALUES ('ABCDE_ABC');
INSERT INTO test_reg_exp (col1) VALUES ('WXYZ_ABCD');
INSERT INTO test_reg_exp (col1) VALUES ('ABCDE_PQRS');
INSERT INTO test_reg_exp (col1) VALUES ('ABCD_WXYZ');
ALTER TABLE test_reg_exp
ADD (col2 VARCHAR2(100) GENERATED ALWAYS AS (REGEXP_REPLACE (col1, '^ABCD[A-Z]*_')));
SQL Error: ORA-12899: value too large for column "COL2" (actual: 100, maximum: 400)
12899. 00000 - "value too large for column %s (actual: %s, maximum: %s)"
*Cause: An attempt was made to insert or update a column with a value
which is too wide for the width of the destination column.
The name of the column is given, along with the actual width
of the value, and the maximum allowed width of the column.
Note that widths are reported in characters if character length
semantics are in effect for the column, otherwise widths are
reported in bytes.
*Action: Examine the SQL statement for correctness. Check source
and destination column data types.
Either make the destination column wider, or use a subset
of the source column (i.e. use substring).When I try to select, I'm getting correct results:
SELECT col1, (REGEXP_REPLACE (col1, '^ABCD[A-Z]*_'))
FROM test_reg_exp;Thanks.Yes RP, it working if you give col2 size >=400.
@Northwest - Could you please test the same w/o having a regex clause in col2?
I doubt on the usage of a REGEX in this dynamic col case.
Refer this (might help) -- http://www.oracle-base.com/articles/11g/virtual-columns-11gr1.php
Below snippet from above link.... see if this helps...
>
Notes and restrictions on virtual columns include:
Indexes defined against virtual columns are equivalent to function-based indexes.
Virtual columns can be referenced in the WHERE clause of updates and deletes, but they cannot be manipulated by DML.
Tables containing virtual columns can still be eligible for result caching.
Functions in expressions must be deterministic at the time of table creation, but can subsequently be recompiled and made non-deterministic without invalidating the virtual column. In such cases the following steps must be taken after the function is recompiled:
Constraint on the virtual column must be disabled and re-enabled.
Indexes on the virtual column must be rebuilt.
Materialized views that access the virtual column must be fully refreshed.
The result cache must be flushed if cached queries have accessed the virtual column.
Table statistics must be regathered.
Virtual columns are not supported for index-organized, external, object, cluster, or temporary tables.
The expression used in the virtual column definition has the following restrictions:
It cannot refer to another virtual column by name.
It can only refer to columns defined in the same table.
If it refers to a deterministic user-defined function, it cannot be used as a partitioning key column.
The output of the expression must be a scalar value. It cannot return an Oracle supplied datatype, a user-defined type, or LOB or LONG RAW.
>
Edited by: ranit B on Oct 16, 2012 11:48 PM
Edited by: ranit B on Oct 16, 2012 11:54 PM -
Want to use analytical function as a Virtual column
I am wondering if I can use an analytic function as a virtual column to a table?
The table conatins a field named BUSINESS_RUN_DATE, which becomes the EXPIRY_DATE of the on the previous record. So we want to add this value right into the table without resorting t a view.
This is what I tried to add the column to the table:
alter table stg_xref_test_virtual
ADD (expiry_date2 date generated always AS (max (business_run_date) over
*(PARTITION BY ntrl_src_sys_key order by business_run_date*
rows between 1 preceding and 1 following))) ;
It give me an error that GROUP BY is not allowed.
Can someone help out>?
Thanks,
IanFrom the documentation.
[Column Expressions|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/expressions005.htm#BABIGHHI]
A column expression, which is designated as column_expr in subsequent syntax diagrams, is a limited form of expr. A column expression can be a simple expression, compound expression, function expression, or expression list, but it can contain only the following forms of expression:* Columns of the subject table — the table being created, altered, or indexed
* Constants (strings or numbers)
** Deterministic functions — either SQL built-in functions or user-defined functions*
No other expression forms described in this chapter are valid. In addition, compound expressions using the PRIOR keyword are not supported, nor are aggregate functions.
You can use a column expression for these purposes:
* To create a function-based index.
* To explicitly or implicitly define a virtual column. When you define a virtual column, the defining column_expr must refer only to columns of the subject table that have already been defined, in the current statement or in a prior statement.
The combined components of a column expression must be deterministic. That is, the same set of input values must return the same set of output values. -
When Closing the window giving error " Virtual Column not allowed"
Hi All,
In my main block, i have a button, on clicking which will open a new window(block) with a free text field to enter.
I have a Save button in a new window which will save entered text fiedl and refresh the main block to see the value entered in a new block.
But suppose, if entered something in text field and without saving if i close the window and try to exit from the form
It is asking me to save the form or not and if i press Yes
Then it gives me below error
ORA-01733: virtual column not allowed here
FRM-40508: ORACLE error: unable to INSERT record.
If i see from Display database error' It is trying to insert the record into the view On which my new block has based( i know it is not possible).
Any suggestion on this please?
Thanks,
pavanPavan,
How are you populating your block? It sounds like you are populating the block manually (eg; Looping through a cursor and assigning values to each row of your block). If this is what you are doing, then YES you will get these kinds of errors. Ideally, you should base your data block on your data (either directly on the base table or view of if you are using a query, then a FROM Clause based block).
I'm guessing here, so would you mind posting a description of your data block(s) is/are set up?
Craig... -
Virtual column in a View contains null
Hi experts !
I have created a virtual column in one of the database tables. Now when i try to create a view that is based on a select statement with multiple joins, all columns in view are correct except virtual one. it is all null.
can anyone please help me out. i have tried removing the joins from the select statement. It works fine when there is only join. if select statement has more then one join, the virtual column becomes null in view.
Please help me out. m badly stuckSir William!
please alter the link. Though i have found a workaround but its not proper solution. I have created a view will all the joins, and then created another view joining that view and the virtual column. but it would be really informative to know what is causing such behavior.
Best Regards -
ORA-00939 when creating XML table with Virtual Columns
Getting error on creating table with VIRTUAL COLUMNS:
Error at Command Line:4 Column:31
Error report:
SQL Error: ORA-00939: too many arguments for function
00939. 00000 - "too many arguments for function"
Without VIRTUAL COLUMNS works fine.
Where to start?
Is it possible to add Virtual Columns after a table is created?
CREATE TABLE TDS_XML OF XMLType
XMLSCHEMA "http://xmlns.abc.com/tds/TDSSchemaGen2.xsd"
ELEMENT "TDSTestData"
VIRTUAL COLUMNS
TESTID AS (
XMLCast(
XMLQuery('declare default element namespace "http://xmlns.abc.com/tds/TDSSchemaGen2.xsd"; /TDSTestData/TestID' PASSING OBJECT_VALUE RETURNING CONTENT) AS VARCHAR2(32)
)SQL*Plus: Release 11.2.0.2.0 Production on Mon Apr 30 20:17:29 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for 64-bit Windows: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL>victor_shostak wrote:
Figured, Virtual Columns work only for Binary XML.They are only supported, currently, for Binary XML. -
Hi all,
I m migrating from 10g to 11g.I have doubt on virtual column.whether function based index and virtual column are same?
if no means what difference between then.What are difference in their performance??No, they aren't the same.
if no means what difference between then
Function based index is a "INDEX" whereas virtual column is a "COLUMN". Both are two different Database objects.
What are difference in their performance??
You can't compare peformance of a Column with that of a Index.
Virtual columns appear to be normal table columns, but their values are derived rather than being stored on disc. E.g.,
CREATE TABLE employees (
id NUMBER,
first_name VARCHAR2(10),
last_name VARCHAR2(10),
salary NUMBER(9,2),
comm1 NUMBER(3),
comm2 NUMBER(3),
salary1 AS (ROUND(salary*(1+comm1/100),2)),
salary2 NUMBER GENERATED ALWAYS AS (ROUND(salary*(1+comm2/100),2)) VIRTUAL, -- This is
your virtual column
CONSTRAINT employees_pk PRIMARY KEY (id)
For more info, you can refer to Oracle Documentation and below is additional link from asktom
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:676611400346196844
Ishan -
Hide columns based on Authorization
Experts,
In a report i would like to hide few columns based on the authorization, only few users should be able to see
these columns but rest of the users should be able to view the report but not these columns. these columns
should either not visible on the report or display ****** for the data of these columns.
I tried to create authorization object in RSECADMIN but the problem is if a user doesn't have this
authorization he cannot even view the report it display the message "No Authorization".
any suggestions/help is greatly appreciated.
Thanks.Hi Geni,
You have two choice.
1. Override the column value to **** using virtual characteristics code
Assign a role to users who has authorization to see the columns
In Virtual charachteristics code, read table AGR_USERS table based on the sy-uname
If the role that is assigned for the columns is found do nothing, else overwrite it with ****
2. Create a User exit variable, in the variable code read the authorization of the user like above
If the role found assign 1 else assign 0.
Create a formula in the columns area and multiply your column value with the user exit variable value.
Suppress zero columns using the query properties.
Good luck,
Vijay
Maybe you are looking for
-
2011 Macbook pro continues to have issues what should I do?
In 2011 I purchased an early 2011 2.2 i7 Macbook Pro new. Not long after I bought it I began to have graphics issues with the computer. The computer was sent into Apple and a logicboard replacement was done. I continued to have intermediate issues wi
-
View current downloads in iTunes 11
Am I missing something or is the current downloads item missing from under the Store when downloading podcasts in 11? Thanks in advance.
-
HA SSO doesnt sync certificates between primary and standby
Hi, Since the HA SSO doesn't sync device certificates, how do I get the certs used to authenticate devices (laptops) onto the standby controller? Thanks.
-
Actions wont load on launching saids error couldn't continue the rest of the program loads
has any one had the problem with the actions not completely loading on relaunch?
-
Hello, I want to install the windows 7 in laptops alinware, after the finish yet I got one error about " Windows cannot complete installation, to continue installing windows , restart the computer" after that restart I get this error again,,,, pleas