Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Tuesday, February 23, 2010

Rare Index with Double Quotes


Came across this rare index.

SQL> select index_name from dba_indexes where tablespace_name='MEDIUM_DATA';

INDEX_NAME
UK_F_PLAN_FC_ACT_jan
F_PLAN_FC_ACT_OLTAS_INDEX1_jan

2 rows selected.

SQL> alter index star.UK_F_PLAN_FC_ACT_jan rebuild;
alter index star.UK_F_PLAN_FC_ACT_jan rebuild
*
ERROR at line 1:
ORA-01418: specified index does not exist


SQL> alter index star."UK_F_PLAN_FC_ACT_jan" rebuild;

Index altered.

SQL>

Found a hint that it needs to be invoked with double quotes ""

Monday, February 8, 2010

Sample Dataset for Oracle

I was recently working on a project where there was a demand to have random set of sales and transaction data to test performance. Well I thought of a better solution and it worked out with this website http://www.generatedata.com

Interestingly the dataset can be generated directly on the website itself and the maximum rows that will be generated is 5000.

The result output can be on different forms like excel,csv,html,xml and sql.
SQL was the best part , the page gives option to select the database type and then the tablename.
By default it creates the script with the create tablename and then the insert statements.

I hope this will help people who need sample dataset.

Tuesday, January 19, 2010

Limitation in DECODE Function


If you happen to receive "ORA-00939: too many arguments for function" in a complex query then you may need to first look into the DECODE statement. There seems to be some limitation with the decode function that it can hold a maximum number of 255 components. It includes the expression , search and the results arguments.

Interestingly in Discoverer Environment the complex folders which holds the decode function disappears when it exceeds this limit. Creating a large decode will also generate the same error in the Desktop Edition; however, the complex folder will not disappear in this case.