Constraints (Part 5) - ORA-02270, ORA-02249, ORA-02291 and ORA-02292
Go to part 4 This example, tested on an Oracle 9 database, starts to look at foreign key constraints. First create a department table. Each row has a department number and description:SQL> create...
View ArticleConstraints (Part 6) - On Delete Cascade
Go to part 5There is more than one way to create a foreign key constraint. This example, tested on an Oracle 9 database, uses the on delete cascade clause. First create a department table: SQL>...
View ArticleConstraints (Part 7) - On Delete Set Null
This example was tested on Oracle 9. It creates another foreign key constraint. First create emp and dept tables as before. Note the on delete set null clause when the employee table is created. We...
View ArticleRaw Columns
#yiv9010210031 _filtered #yiv9010210031 { FONT-FAMILY: "Cambria Math"; panose-1: 2 4 5 3 5 4 6 3 2 4 } _filtered #yiv9010210031 { FONT-FAMILY: Calibri; panose-1: 2 15 5 2 2 2 4 3 2 4 } #yiv9010210031...
View ArticleOracle export and deferred segment creation
A colleague told me about an issue when using export on an Oracle 11.2.0.1 database. He said that if the database contains tables created with segment creation deferred, those tables will not be...
View ArticleSQL Developer Performance Issue
This happened when I was using SQL Developer in an Oracle 11.1.0.6 database. I clicked on the + sign next to Tables (Filtered) in the top left hand corner of the screen below (as usual, click on the...
View ArticleORA-00026
This was tested on Oracle 9. When you use the ALTER SYSTEM KILL SESSION command, you must supply the SID and SERIAL# from an entry in V$SESSION. You get an ORA-00026 if you do not provide one: SQL>...
View ArticleOracle export and deferred segment creation
A colleague told me about an issue when using export on an Oracle 11.2.0.1 database. He said that if the database contains tables created with segment creation deferred, those tables will not be...
View ArticlePL/SQL Runs on the Server, not on the Client
I read in a book that PL/SQL runs on the server, not the client so I decided to check this out. I started a Command prompt on my Windows PC and used a SQL*Plus session to connect to a database on a...
View ArticleORA-01427
This was tested on Oracle 11.2. I created a small table as shown below: SQL> select * from emp 2 order by emp_name, year 3 / EMP_NAME YEAR SALARY---------- ---- ----------ANGUS 2000...
View ArticleWhen you Create a Role it is Granted to you Automatically
I noticed recently that, when you create a role, it is automatically granted to you with the admin option. You can see what I mean in the example below, which I tested in Oracle 11.2: SQL> conn...
View ArticleORA-00018 and ORA-02095
A user complained about ORA-00018 errors when trying to connect to an Oracle 11.1 database from PL/SQL Developer. I checked in the alert log and saw the following message several times:Mon Nov 25...
View ArticleOracle export and deferred segment creation
A colleague told me about an issue when using export on an Oracle 11.2.0.1 database. He said that if the database contains tables created with segment creation deferred, those tables will not be...
View ArticleDROP TABLE ... PURGE
I tested this on Oracle 11.2.0.2.7. If the recyclebin is in use:SQL> conn / as sysdbaConnected.SQL> select value from v$parameter 2 where name = 'recyclebin' 3 / VALUE----------on SQL> ......
View ArticleORA-01441
This was tested on Oracle 11.2. I created a table with one VARCHAR2 column, which was 15 characters long:SQL> create table tab1 (col1 varchar2(15)) 2 / Table created.SQL>I inserted one row,...
View ArticlePL/SQL GOTO Statement
I remember using the GO TO statement when I used to program in COBOL.PL/SQL has a GOTO statement as well, which directs control to a label enclosed by a << and a >>. There must always be at...
View ArticleORA-12899
If you try to update a column with a value which is too big, you get an ORA-12899. If this happens in a PL/SQL block, all the updates done in that block will be rolled back, not just the one which...
View ArticleORA-01086
You can only rollback to a savepoint if it was created in the current transaction. You can see this in the example below, which I tested on Oracle 11.2: SQL> savepoint sp1; Savepoint created....
View ArticleHow to Provide User Input to PL/SQL
Here are some simple examples tested on Oracle 11.2. You can use a variable beginning with one ampersand: SQL> !cat accept1.sqlbegindbms_output.put_line('Hello &your_name');end;/ If you do this,...
View ArticleORA-02289
This was tested on Oracle 11.2. You can create a sequence and select the next value from it like this: SQL> create sequence seq1 2 / Sequence created. SQL> select seq1.nextval from dual 2 /...
View Article