Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It violates basic normalization to have one column in a table that depends on the data in other columns. It is possible to use triggers to try to keep the data in sync but that is generally rather cumbersome. You're generally much better served by</p> <ol> <li>Removing the <code>full_name</code> column from the table entirely. Create a function that calculates the <code>full_name</code> and either call that function from the application when you want to generate the full name or add the function call to the view that applications use to query the data. You can create a function-based index on the results of this function if you need to search by the full name.</li> <li>If you are using Oracle 11.1 or later, you can define a <a href="http://www.oracle-base.com/articles/11g/virtual-columns-11gr1.php" rel="nofollow">virtual column</a> in the table that computes the <code>full_name</code>.</li> </ol> <p>The virtual column approach will look something like</p> <pre><code>SQL&gt; ed Wrote file afiedt.buf 1 create table foo ( 2 first_name varchar2(100), 3 last_name varchar2(100), 4 middle_name varchar2(100), 5 full_name varchar2(304) generated always as (last_name || ', ' || 6 first_name || 7 (case when middle_name is not null 8 then ', ' || middle_name 9 else null 10* end)) virtual ) SQL&gt; / Table created. SQL&gt; insert into foo(first_name, last_name, middle_name) 2 values( 'Justin', 'Cave', 'O.J.' ); 1 row created. SQL&gt; select full_name from foo; FULL_NAME -------------------------------------------------------------------------------- Cave, Justin, O.J. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload