PL/SQL CASE Statement
This is an alternative to if… then… else… elsif… end if when you want to use conditional statements in PL/SQL. Here is a simple example, which checks whether a given number is 1 or 2. You start with...
View ArticlePassword Expire
If a user forgets his password, he may ask you to reset it for him. You will then know his new password, which you may see as a security issue. By including the password expire clause in the alter user...
View ArticleORA-01440
I was asked to run some SQL today and it generated an ORA-01440. I did not remember having seen this error before so I decided to check it out in an Oracle 11.2 database. First I created a table and...
View ArticleON COMMIT Materialized View Causes ORA-02050 and ORA-02051
This example replicates a problem I discovered today. I tested it in an Oracle 11.2 database. First I created an empty table called tab1:SQL> create table tab1 2 (col1 varchar2(30), 3...
View ArticleSetting NUMWIDTH in PL/SQL Developer
This post is based on a problem I was asked to look at recently. A colleague was using PL/SQL Developer to compare two tables in an Oracle 11 database. He was matching the rows on a key column then...
View ArticleORA-01166
We have some jobs which copy the datafiles from 1 database to another then recreate the control file to give the output database a new name. Some of these jobs are intelligent i.e. they query the input...
View ArticleALTER USER Hangs on row cache lock
I created the following UNIX shell script called loop1.ksh:Oracle 11.1 > cat loop1.ksh#!/bin/bashexport ORACLE_SID=PQEDPT1export ORAENV_ASK=NO. oraenvsqlplus / as sysdba << eofgrant create...
View ArticleSay Hello
I will be going to a seminar about Oracle 12 next week at Oracle City Office, 1 South Place, London. It is called:Oracle Database 12c– Latest Features, Upgrades & Migrations Seminar and will take...
View ArticleLOGICAL_READS_PER_SESSION
One of the resources you can limit in a profile is called logical_reads_per_session. According to the Oracle documentation, it is used to:Specify the permitted number of data blocks read in a session,...
View Articledb_writer_processes
I wrote the first part of this example in 2012. The database writer copies data blocks from the buffer cache onto disk. The db_writer_processes initialization parameter determines how many processes...
View ArticleO7_DICTIONARY_ACCESSIBILITY
Long ago, in Oracle 7 I believe, a user with the SELECT ANY TABLE privilege could access tables and views owned by SYS. Also, a user with the EXECUTE ANY PROCEDURE privilege could run code owned by...
View ArticleAUTHID CURRENT_USER
If USERA creates a function or procedure and allows USERB to run it, USERB does so with USERA’s permissions. However, if USERA adds the AUTHID CURRENT_USER clause to the code, USERB runs it with its...
View ArticleUK OUG Conference 2015
I went to the UK OUG Conference for the first time around 12 years ago, in 2003 if I remember correctly. I enjoyed all the presentations but the two which stuck in my mind were by Jonathan Lewis and...
View ArticleSELECT ANY SEQUENCE
I used to think that a user with SELECT ANY TABLE and SELECT ANY DICTIONARY could see anything in a database. I found out today that these 2 privileges do not allow you to SELECT from another user’s...
View ArticlePRAGMA EXCEPTION_INIT
You can use one of these to link an exception name with an Oracle error number. Once you have done this, you can use the exception name in the exception block which follows the declaration. You can see...
View ArticleGRANT SELECT Updates LAST_DDL_TIME
DDL stands for Data Definition Language. The CREATE TABLE, ALTER TABLE and DROP TABLE statements are examples of DDL. LAST_DDL_TIME is a column in the USER_OBJECTS view. It records the date and time of...
View ArticleSegment Creation Deferred not Available in Standard Edition
If you use Oracle Standard Edition to create a production database, you need to be sure to create any corresponding test databases in Oracle Standard Edition too. Otherwise you may find that some SQL...
View ArticleA Problem with REVOKE
If you grant the DBA role to a user, Oracle also grants it the UNLIMITED TABLESPACE system privilege. If you then revoke the DBA role from this user, Oracle also revokes its UNLIMITED TABLESPACE system...
View ArticleA Simple Example of an Index Organised Table Without Overflow
For a long time I have had a note on my task list to learn about index organized tables. I never got round to doing it because I thought I would never see one. However, I came across several in a 3rd...
View ArticleOracle Live SQL
I had the opportunity to attend the UKOUG Conference recently. While I was there, I went to a Roundtable run by Shakeeb Rahman from Oracle. He told us about an Oracle tool which allows you to run SQL...
View Article